home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / GameCreators / TADS / manuals / TEX / TADSUSEX.TEX < prev    next >
LaTeX Document  |  1992-11-13  |  12.4 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: TADSUSEX.TEX

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document, ASCII text, with CRLF line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried x-fmt/111 Plain Text File default
100% detectItEasy Format: plain text[CRLF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 24 48 65 61 64 65 | 72 3a 20 63 3a 2f 74 61 |% $Heade|r: c:/ta|
|00000010| 64 73 2f 64 6f 63 2f 52 | 43 53 2f 74 61 64 73 75 |ds/doc/R|CS/tadsu|
|00000020| 73 65 78 2e 74 65 78 20 | 31 2e 31 20 39 32 2f 31 |sex.tex |1.1 92/1|
|00000030| 31 2f 31 33 20 31 36 3a | 34 36 3a 32 34 20 6d 72 |1/13 16:|46:24 mr|
|00000040| 6f 62 65 72 74 73 20 45 | 78 70 20 24 0d 0a 25 20 |oberts E|xp $..% |
|00000050| 43 6f 70 79 72 69 67 68 | 74 20 28 63 29 20 31 39 |Copyrigh|t (c) 19|
|00000060| 39 32 20 62 79 20 4d 69 | 63 68 61 65 6c 20 4a 2e |92 by Mi|chael J.|
|00000070| 20 52 6f 62 65 72 74 73 | 2e 20 20 41 6c 6c 20 52 | Roberts|. All R|
|00000080| 69 67 68 74 73 20 52 65 | 73 65 72 76 65 64 2e 0d |ights Re|served..|
|00000090| 0a 25 20 41 70 70 65 6e | 64 69 78 20 46 3a 20 55 |.% Appen|dix F: U|
|000000a0| 73 65 72 20 45 78 69 74 | 73 0d 0a 0d 0a 5c 63 68 |ser Exit|s....\ch|
|000000b0| 61 70 74 65 72 68 65 61 | 64 65 72 7b 41 70 70 65 |apterhea|der{Appe|
|000000c0| 6e 64 69 78 20 46 7d 7b | 45 78 74 65 72 6e 61 6c |ndix F}{|External|
|000000d0| 20 46 75 6e 63 74 69 6f | 6e 73 7d 7b 46 7d 0d 0a | Functio|ns}{F}..|
|000000e0| 0d 0a 54 41 44 53 20 68 | 61 73 20 61 20 66 61 63 |..TADS h|as a fac|
|000000f0| 69 6c 69 74 79 20 74 68 | 61 74 20 61 6c 6c 6f 77 |ility th|at allow|
|00000100| 73 20 79 6f 75 20 74 6f | 20 63 61 6c 6c 20 61 20 |s you to| call a |
|00000110| 66 75 6e 63 74 69 6f 6e | 20 77 72 69 74 74 65 6e |function| written|
|00000120| 20 69 6e 20 61 6e 6f 74 | 68 65 72 0d 0a 6c 61 6e | in anot|her..lan|
|00000130| 67 75 61 67 65 2c 20 73 | 75 63 68 20 61 73 20 43 |guage, s|uch as C|
|00000140| 20 6f 72 20 41 73 73 65 | 6d 62 6c 65 72 2c 20 66 | or Asse|mbler, f|
|00000150| 72 6f 6d 20 77 69 74 68 | 69 6e 20 79 6f 75 72 20 |rom with|in your |
|00000160| 54 41 44 53 20 67 61 6d | 65 20 70 72 6f 67 72 61 |TADS gam|e progra|
|00000170| 6d 2e 0d 0a 57 65 20 72 | 65 66 65 72 20 74 6f 20 |m...We r|efer to |
|00000180| 74 68 65 73 65 20 72 6f | 75 74 69 6e 65 73 20 77 |these ro|utines w|
|00000190| 72 69 74 74 65 6e 20 69 | 6e 20 6f 74 68 65 72 20 |ritten i|n other |
|000001a0| 6c 61 6e 67 75 61 67 65 | 73 20 61 73 20 60 60 5e |language|s as ``^|
|000001b0| 7b 65 78 74 65 72 6e 61 | 6c 0d 0a 66 75 6e 63 74 |{externa|l..funct|
|000001c0| 69 6f 6e 73 7d 27 27 20 | 6f 72 20 60 60 5e 7b 75 |ions}'' |or ``^{u|
|000001d0| 73 65 72 20 65 78 69 74 | 73 7d 2e 27 27 20 20 54 |ser exit|s}.'' T|
|000001e0| 68 69 73 20 61 70 70 65 | 6e 64 69 78 20 64 65 73 |his appe|ndix des|
|000001f0| 63 72 69 62 65 73 20 68 | 6f 77 20 74 6f 20 77 72 |cribes h|ow to wr|
|00000200| 69 74 65 0d 0a 61 6e 64 | 20 69 6e 76 6f 6b 65 20 |ite..and| invoke |
|00000210| 65 78 74 65 72 6e 61 6c | 20 66 75 6e 63 74 69 6f |external| functio|
|00000220| 6e 73 2e 0d 0a 0d 0a 0d | 0a 5c 63 68 61 70 74 65 |ns......|.\chapte|
|00000230| 72 62 6f 64 79 0d 0a 0d | 0a 59 6f 75 20 6d 61 79 |rbody...|.You may|
|00000240| 20 77 69 73 68 20 74 6f | 20 62 65 20 61 62 6c 65 | wish to| be able|
|00000250| 20 74 6f 20 69 6e 76 6f | 6b 65 20 61 20 66 75 6e | to invo|ke a fun|
|00000260| 63 74 69 6f 6e 20 77 72 | 69 74 74 65 6e 20 69 6e |ction wr|itten in|
|00000270| 20 61 6e 6f 74 68 65 72 | 20 6c 61 6e 67 75 61 67 | another| languag|
|00000280| 65 2c 0d 0a 73 75 63 68 | 20 61 73 20 43 20 6f 72 |e,..such| as C or|
|00000290| 20 41 73 73 65 6d 62 6c | 65 72 2c 20 66 72 6f 6d | Assembl|er, from|
|000002a0| 20 77 69 74 68 69 6e 20 | 79 6f 75 72 20 67 61 6d | within |your gam|
|000002b0| 65 20 70 72 6f 67 72 61 | 6d 2e 20 20 46 6f 72 20 |e progra|m. For |
|000002c0| 65 78 61 6d 70 6c 65 2c | 20 79 6f 75 0d 0a 6d 61 |example,| you..ma|
|000002d0| 79 20 77 61 6e 74 20 74 | 6f 20 77 72 69 74 65 20 |y want t|o write |
|000002e0| 61 20 66 75 6e 63 74 69 | 6f 6e 20 74 68 61 74 20 |a functi|on that |
|000002f0| 72 65 61 64 73 20 73 6f | 6d 65 20 69 6e 66 6f 72 |reads so|me infor|
|00000300| 6d 61 74 69 6f 6e 20 66 | 72 6f 6d 20 61 20 64 69 |mation f|rom a di|
|00000310| 73 6b 0d 0a 66 69 6c 65 | 2c 20 6f 72 20 79 6f 75 |sk..file|, or you|
|00000320| 20 6d 61 79 20 77 61 6e | 74 20 74 6f 20 70 72 6f | may wan|t to pro|
|00000330| 67 72 61 6d 20 74 68 65 | 20 73 6f 75 6e 64 20 68 |gram the| sound h|
|00000340| 61 72 64 77 61 72 65 20 | 6f 6e 20 79 6f 75 72 20 |ardware |on your |
|00000350| 63 6f 6d 70 75 74 65 72 | 2e 0d 0a 54 41 44 53 20 |computer|...TADS |
|00000360| 61 6c 6c 6f 77 73 20 79 | 6f 75 20 74 6f 20 64 6f |allows y|ou to do|
|00000370| 20 74 68 69 73 20 74 68 | 72 6f 75 67 68 20 61 20 | this th|rough a |
|00000380| 6d 65 63 68 61 6e 69 73 | 6d 20 6b 6e 6f 77 6e 20 |mechanis|m known |
|00000390| 61 73 20 60 60 75 73 65 | 72 20 65 78 69 74 73 27 |as ``use|r exits'|
|000003a0| 27 0d 0a 6f 72 20 60 60 | 65 78 74 65 72 6e 61 6c |'..or ``|external|
|000003b0| 20 66 75 6e 63 74 69 6f | 6e 73 2e 27 27 0d 0a 0d | functio|ns.''...|
|000003c0| 0a 0d 0a 42 65 66 6f 72 | 65 20 67 6f 69 6e 67 20 |...Befor|e going |
|000003d0| 66 75 72 74 68 65 72 2c | 20 77 65 20 73 68 6f 75 |further,| we shou|
|000003e0| 6c 64 20 77 61 72 6e 20 | 79 6f 75 20 74 68 61 74 |ld warn |you that|
|000003f0| 20 77 72 69 74 69 6e 67 | 20 61 20 75 73 65 72 20 | writing| a user |
|00000400| 65 78 69 74 0d 0a 69 73 | 20 73 6f 6d 65 77 68 61 |exit..is| somewha|
|00000410| 74 20 63 6f 6d 70 6c 69 | 63 61 74 65 64 2e 20 20 |t compli|cated. |
|00000420| 57 65 27 76 65 20 74 72 | 69 65 64 20 74 6f 20 6d |We've tr|ied to m|
|00000430| 61 6b 65 20 69 74 20 61 | 73 20 65 61 73 79 20 61 |ake it a|s easy a|
|00000440| 73 20 70 6f 73 73 69 62 | 6c 65 0d 0a 74 6f 20 77 |s possib|le..to w|
|00000450| 72 69 74 65 20 61 6e 20 | 65 78 74 65 72 6e 61 6c |rite an |external|
|00000460| 20 66 75 6e 63 74 69 6f | 6e 2c 20 62 75 74 20 79 | functio|n, but y|
|00000470| 6f 75 20 77 69 6c 6c 20 | 68 61 76 65 20 74 6f 20 |ou will |have to |
|00000480| 6c 65 61 72 6e 20 61 20 | 6e 75 6d 62 65 72 0d 0a |learn a |number..|
|00000490| 6f 66 20 73 75 62 74 6c | 65 20 64 65 74 61 69 6c |of subtl|e detail|
|000004a0| 73 20 69 6e 20 6f 72 64 | 65 72 20 74 6f 20 75 73 |s in ord|er to us|
|000004b0| 65 20 74 68 69 73 20 6d | 65 63 68 61 6e 69 73 6d |e this m|echanism|
|000004c0| 2e 20 20 46 75 72 74 68 | 65 72 6d 6f 72 65 2c 0d |. Furth|ermore,.|
|000004d0| 0a 77 65 20 64 6f 6e 27 | 74 20 68 61 76 65 20 74 |.we don'|t have t|
|000004e0| 68 65 20 73 70 61 63 65 | 20 69 6e 20 74 68 69 73 |he space| in this|
|000004f0| 20 61 70 70 65 6e 64 69 | 78 20 28 6f 72 20 74 68 | appendi|x (or th|
|00000500| 65 20 70 65 64 61 67 6f | 67 69 63 61 6c 0d 0a 66 |e pedago|gical..f|
|00000510| 61 63 69 6c 69 74 79 29 | 20 74 6f 20 70 72 6f 76 |acility)| to prov|
|00000520| 69 64 65 20 61 6e 79 20 | 69 6e 66 6f 72 6d 61 74 |ide any |informat|
|00000530| 69 6f 6e 20 61 62 6f 75 | 74 20 70 72 6f 67 72 61 |ion abou|t progra|
|00000540| 6d 6d 69 6e 67 20 69 6e | 20 43 20 6f 72 0d 0a 41 |mming in| C or..A|
|00000550| 73 73 65 6d 62 6c 65 72 | 20 6f 72 20 61 6e 79 20 |ssembler| or any |
|00000560| 6f 74 68 65 72 20 6c 61 | 6e 67 75 61 67 65 2c 20 |other la|nguage, |
|00000570| 6f 72 20 61 62 6f 75 74 | 20 75 73 69 6e 67 20 79 |or about| using y|
|00000580| 6f 75 72 20 63 6f 6d 70 | 69 6c 65 72 20 6f 72 20 |our comp|iler or |
|00000590| 6c 69 6e 6b 65 72 0d 0a | 6f 72 20 6f 74 68 65 72 |linker..|or other|
|000005a0| 20 70 72 6f 67 72 61 6d | 6d 69 6e 67 20 74 6f 6f | program|ming too|
|000005b0| 6c 73 2e 20 20 53 6f 2c | 20 77 65 27 6c 6c 20 61 |ls. So,| we'll a|
|000005c0| 73 73 75 6d 65 20 74 68 | 61 74 20 79 6f 75 20 61 |ssume th|at you a|
|000005d0| 6c 72 65 61 64 79 20 6b | 6e 6f 77 0d 0a 68 6f 77 |lready k|now..how|
|000005e0| 20 74 6f 20 70 72 6f 67 | 72 61 6d 20 69 6e 20 43 | to prog|ram in C|
|000005f0| 2c 20 61 6e 64 20 74 68 | 61 74 20 79 6f 75 27 72 |, and th|at you'r|
|00000600| 65 20 61 6c 72 65 61 64 | 79 20 66 61 6d 69 6c 69 |e alread|y famili|
|00000610| 61 72 20 77 69 74 68 20 | 79 6f 75 72 0d 0a 70 72 |ar with |your..pr|
|00000620| 6f 67 72 61 6d 6d 69 6e | 67 20 74 6f 6f 6c 73 2e |ogrammin|g tools.|
|00000630| 0d 0a 0d 0a 0d 0a 5c 6d | 69 6e 6f 72 73 65 63 74 |......\m|inorsect|
|00000640| 69 6f 6e 7b 44 65 63 6c | 61 72 69 6e 67 20 61 6e |ion{Decl|aring an|
|00000650| 64 20 49 6e 76 6f 6b 69 | 6e 67 20 61 20 55 73 65 |d Invoki|ng a Use|
|00000660| 72 20 45 78 69 74 7d 0d | 0a 0d 0a 41 73 20 66 61 |r Exit}.|...As fa|
|00000670| 72 20 61 73 20 79 6f 75 | 72 20 54 41 44 53 20 70 |r as you|r TADS p|
|00000680| 72 6f 67 72 61 6d 20 69 | 73 20 63 6f 6e 63 65 72 |rogram i|s concer|
|00000690| 6e 65 64 2c 20 61 6e 20 | 65 78 74 65 72 6e 61 6c |ned, an |external|
|000006a0| 20 66 75 6e 63 74 69 6f | 6e 20 69 73 20 6e 65 61 | functio|n is nea|
|000006b0| 72 6c 79 0d 0a 74 68 65 | 20 73 61 6d 65 20 61 73 |rly..the| same as|
|000006c0| 20 61 20 62 75 69 6c 74 | 2d 69 6e 20 66 75 6e 63 | a built|-in func|
|000006d0| 74 69 6f 6e 2e 20 20 54 | 68 65 20 6f 6e 6c 79 20 |tion. T|he only |
|000006e0| 64 69 66 66 65 72 65 6e | 63 65 20 69 73 20 74 68 |differen|ce is th|
|000006f0| 61 74 20 79 6f 75 20 6d | 75 73 74 0d 0a 74 65 6c |at you m|ust..tel|
|00000700| 6c 20 74 68 65 20 54 41 | 44 53 20 63 6f 6d 70 69 |l the TA|DS compi|
|00000710| 6c 65 72 20 74 68 61 74 | 20 74 68 65 20 66 75 6e |ler that| the fun|
|00000720| 63 74 69 6f 6e 20 69 73 | 20 61 20 75 73 65 72 20 |ction is| a user |
|00000730| 65 78 69 74 3b 20 79 6f | 75 20 64 6f 20 74 68 69 |exit; yo|u do thi|
|00000740| 73 20 62 79 0d 0a 75 73 | 69 6e 67 20 74 68 65 20 |s by..us|ing the |
|00000750| 73 70 65 63 69 61 6c 20 | 7b 5c 74 74 20 65 78 74 |special |{\tt ext|
|00000760| 65 72 6e 61 6c 20 66 75 | 6e 63 74 69 6f 6e 7d 20 |ernal fu|nction} |
|00000770| 64 65 63 6c 61 72 61 74 | 69 6f 6e 2e 20 20 54 68 |declarat|ion. Th|
|00000780| 69 73 20 64 65 63 6c 61 | 72 61 74 69 6f 6e 0d 0a |is decla|ration..|
|00000790| 69 73 20 73 69 6d 69 6c | 61 72 20 74 6f 20 61 20 |is simil|ar to a |
|000007a0| 66 6f 72 77 61 72 64 20 | 64 65 63 6c 61 72 61 74 |forward |declarat|
|000007b0| 69 6f 6e 20 66 6f 72 20 | 61 20 6e 6f 72 6d 61 6c |ion for |a normal|
|000007c0| 20 66 75 6e 63 74 69 6f | 6e 3b 20 66 6f 72 20 65 | functio|n; for e|
|000007d0| 78 61 6d 70 6c 65 2c 0d | 0a 69 66 20 79 6f 75 20 |xample,.|.if you |
|000007e0| 77 69 73 68 20 74 6f 20 | 64 65 66 69 6e 65 20 61 |wish to |define a|
|000007f0| 20 75 73 65 72 20 65 78 | 69 74 20 6e 61 6d 65 64 | user ex|it named|
|00000800| 20 7b 5c 74 74 20 6d 79 | 66 75 6e 63 7d 2c 20 79 | {\tt my|func}, y|
|00000810| 6f 75 20 77 6f 75 6c 64 | 20 69 6e 63 6c 75 64 65 |ou would| include|
|00000820| 0d 0a 61 20 64 65 63 6c | 61 72 61 74 69 6f 6e 20 |..a decl|aration |
|00000830| 6c 69 6b 65 20 74 68 69 | 73 20 69 6e 20 79 6f 75 |like thi|s in you|
|00000840| 72 20 54 41 44 53 20 70 | 72 6f 67 72 61 6d 3a 0d |r TADS p|rogram:.|
|00000850| 0a 5e 5e 7b 65 78 74 65 | 72 6e 61 6c 20 66 75 6e |.^^{exte|rnal fun|
|00000860| 63 74 69 6f 6e 20 64 65 | 63 6c 61 72 61 74 69 6f |ction de|claratio|
|00000870| 6e 7d 0d 0a 0d 0a 7b 5c | 65 78 61 6d 70 6c 65 0d |n}....{\|example.|
|00000880| 0a 6d 79 66 75 6e 63 3a | 20 65 78 74 65 72 6e 61 |.myfunc:| externa|
|00000890| 6c 20 66 75 6e 63 74 69 | 6f 6e 3b 0d 0a 7d 0d 0a |l functi|on;..}..|
|000008a0| 0d 0a 4f 6e 63 65 20 79 | 6f 75 27 76 65 20 64 65 |..Once y|ou've de|
|000008b0| 63 6c 61 72 65 64 20 7b | 5c 74 74 20 6d 79 66 75 |clared {|\tt myfu|
|000008c0| 6e 63 7d 20 61 73 20 61 | 6e 20 65 78 74 65 72 6e |nc} as a|n extern|
|000008d0| 61 6c 20 66 75 6e 63 74 | 69 6f 6e 2c 20 79 6f 75 |al funct|ion, you|
|000008e0| 20 63 61 6e 20 63 61 6c | 6c 0d 0a 69 74 20 6a 75 | can cal|l..it ju|
|000008f0| 73 74 20 61 73 20 79 6f | 75 20 77 6f 75 6c 64 20 |st as yo|u would |
|00000900| 63 61 6c 6c 20 61 6e 79 | 20 62 75 69 6c 74 2d 69 |call any| built-i|
|00000910| 6e 20 6f 72 20 75 73 65 | 72 2d 64 65 66 69 6e 65 |n or use|r-define|
|00000920| 64 20 66 75 6e 63 74 69 | 6f 6e 2e 20 20 46 6f 72 |d functi|on. For|
|00000930| 0d 0a 65 78 61 6d 70 6c | 65 2c 20 79 6f 75 20 63 |..exampl|e, you c|
|00000940| 6f 75 6c 64 20 69 6e 63 | 6c 75 64 65 20 63 6f 64 |ould inc|lude cod|
|00000950| 65 20 6c 69 6b 65 20 74 | 68 69 73 20 69 6e 20 79 |e like t|his in y|
|00000960| 6f 75 72 20 54 41 44 53 | 20 70 72 6f 67 72 61 6d |our TADS| program|
|00000970| 3a 0d 0a 0d 0a 7b 5c 65 | 78 61 6d 70 6c 65 0d 0a |:....{\e|xample..|
|00000980| 78 20 3a 3d 20 6d 79 66 | 75 6e 63 28 31 30 2c 20 |x := myf|unc(10, |
|00000990| 27 68 65 6c 6c 6f 27 29 | 3b 0d 0a 7d 0d 0a 0d 0a |'hello')|;..}....|
|000009a0| 5c 6d 69 6e 6f 72 73 65 | 63 74 69 6f 6e 7b 54 68 |\minorse|ction{Th|
|000009b0| 65 20 53 61 6d 70 6c 65 | 20 55 73 65 72 20 45 78 |e Sample| User Ex|
|000009c0| 69 74 7d 0d 0a 0d 0a 49 | 6e 76 6f 6b 69 6e 67 20 |it}....I|nvoking |
|000009d0| 61 20 75 73 65 72 20 65 | 78 69 74 20 69 73 20 65 |a user e|xit is e|
|000009e0| 61 73 79 3b 20 77 72 69 | 74 69 6e 67 20 61 20 75 |asy; wri|ting a u|
|000009f0| 73 65 72 20 65 78 69 74 | 20 69 73 20 61 20 6c 69 |ser exit| is a li|
|00000a00| 74 74 6c 65 20 6d 6f 72 | 65 0d 0a 63 6f 6d 70 6c |ttle mor|e..compl|
|00000a10| 69 63 61 74 65 64 2e 20 | 20 54 68 65 20 72 65 73 |icated. | The res|
|00000a20| 74 20 6f 66 20 74 68 69 | 73 20 61 70 70 65 6e 64 |t of thi|s append|
|00000a30| 69 78 20 64 65 73 63 72 | 69 62 65 73 20 68 6f 77 |ix descr|ibes how|
|00000a40| 20 74 6f 20 77 72 69 74 | 65 20 61 20 75 73 65 72 | to writ|e a user|
|00000a50| 0d 0a 65 78 69 74 2e 20 | 20 4e 6f 74 65 20 74 68 |..exit. | Note th|
|00000a60| 61 74 20 74 68 65 20 54 | 41 44 53 20 73 6f 66 74 |at the T|ADS soft|
|00000a70| 77 61 72 65 20 63 6f 6e | 74 61 69 6e 73 20 61 20 |ware con|tains a |
|00000a80| 73 61 6d 70 6c 65 20 75 | 73 65 72 20 65 78 69 74 |sample u|ser exit|
|00000a90| 20 77 72 69 74 74 65 6e | 0d 0a 69 6e 20 43 2c 20 | written|..in C, |
|00000aa0| 61 73 20 77 65 6c 6c 20 | 61 73 20 61 20 73 6d 61 |as well |as a sma|
|00000ab0| 6c 6c 20 54 41 44 53 20 | 67 61 6d 65 20 70 72 6f |ll TADS |game pro|
|00000ac0| 67 72 61 6d 20 74 68 61 | 74 20 69 6e 76 6f 6b 65 |gram tha|t invoke|
|00000ad0| 73 20 69 74 3b 20 79 6f | 75 20 77 69 6c 6c 0d 0a |s it; yo|u will..|
|00000ae0| 70 72 6f 62 61 62 6c 79 | 20 66 69 6e 64 20 69 74 |probably| find it|
|00000af0| 20 68 65 6c 70 66 75 6c | 20 74 6f 20 6c 6f 6f 6b | helpful| to look|
|00000b00| 20 61 74 20 74 68 65 20 | 65 78 61 6d 70 6c 65 20 | at the |example |
|00000b10| 74 6f 20 67 65 74 20 61 | 20 62 65 74 74 65 72 20 |to get a| better |
|00000b20| 69 64 65 61 0d 0a 6f 66 | 20 68 6f 77 20 74 68 65 |idea..of| how the|
|00000b30| 20 65 78 74 65 72 6e 61 | 6c 20 66 75 6e 63 74 69 | externa|l functi|
|00000b40| 6f 6e 20 6d 65 63 68 61 | 6e 69 73 6d 20 77 6f 72 |on mecha|nism wor|
|00000b50| 6b 73 2e 20 20 54 68 65 | 20 75 73 65 72 20 65 78 |ks. The| user ex|
|00000b60| 69 74 20 69 74 73 65 6c | 66 0d 0a 69 73 20 63 6f |it itsel|f..is co|
|00000b70| 6e 74 61 69 6e 65 64 20 | 69 6e 20 74 68 65 20 66 |ntained |in the f|
|00000b80| 69 6c 65 20 7b 5c 74 74 | 20 54 45 53 54 55 58 2e |ile {\tt| TESTUX.|
|00000b90| 43 7d 3b 20 74 68 65 20 | 54 41 44 53 20 67 61 6d |C}; the |TADS gam|
|00000ba0| 65 20 70 72 6f 67 72 61 | 6d 20 74 68 61 74 0d 0a |e progra|m that..|
|00000bb0| 69 6e 76 6f 6b 65 73 20 | 74 68 65 20 75 73 65 72 |invokes |the user|
|00000bc0| 20 65 78 69 74 20 69 73 | 20 69 6e 20 74 68 65 20 | exit is| in the |
|00000bd0| 66 69 6c 65 20 7b 5c 74 | 74 20 54 45 53 54 55 58 |file {\t|t TESTUX|
|00000be0| 2e 54 7d 2e 20 20 59 6f | 75 20 6d 61 79 20 61 6c |.T}. Yo|u may al|
|00000bf0| 73 6f 0d 0a 77 61 6e 74 | 20 74 6f 20 63 6f 6e 73 |so..want| to cons|
|00000c00| 75 6c 74 20 7b 5c 74 74 | 20 54 41 44 53 45 58 49 |ult {\tt| TADSEXI|
|00000c10| 54 2e 48 7d 2c 20 77 68 | 69 63 68 20 69 73 20 61 |T.H}, wh|ich is a|
|00000c20| 20 66 69 6c 65 20 74 68 | 61 74 20 79 6f 75 20 73 | file th|at you s|
|00000c30| 68 6f 75 6c 64 0d 0a 69 | 6e 63 6c 75 64 65 20 69 |hould..i|nclude i|
|00000c40| 6e 20 79 6f 75 72 20 43 | 20 75 73 65 72 20 65 78 |n your C| user ex|
|00000c50| 69 74 73 3b 20 74 68 69 | 73 20 66 69 6c 65 20 64 |its; thi|s file d|
|00000c60| 65 66 69 6e 65 73 20 74 | 68 65 20 69 6e 74 65 72 |efines t|he inter|
|00000c70| 66 61 63 65 0d 0a 62 65 | 74 77 65 65 6e 20 54 41 |face..be|tween TA|
|00000c80| 44 53 20 61 6e 64 20 79 | 6f 75 72 20 65 78 74 65 |DS and y|our exte|
|00000c90| 72 6e 61 6c 20 66 75 6e | 63 74 69 6f 6e 20 77 69 |rnal fun|ction wi|
|00000ca0| 74 68 20 65 61 73 79 2d | 74 6f 2d 75 73 65 20 6d |th easy-|to-use m|
|00000cb0| 61 63 72 6f 73 2e 0d 0a | 5e 5e 7b 54 45 53 54 55 |acros...|^^{TESTU|
|00000cc0| 58 2e 54 7d 0d 0a 5e 5e | 7b 54 45 53 54 55 58 2e |X.T}..^^|{TESTUX.|
|00000cd0| 43 7d 0d 0a 5e 5e 7b 54 | 41 44 53 45 58 49 54 2e |C}..^^{T|ADSEXIT.|
|00000ce0| 48 7d 0d 0a 0d 0a 4e 6f | 74 65 20 74 68 61 74 20 |H}....No|te that |
|00000cf0| 74 68 65 20 70 72 6f 63 | 65 73 73 20 6f 66 20 63 |the proc|ess of c|
|00000d00| 6f 6d 70 69 6c 69 6e 67 | 0d 0a 61 6e 64 20 6c 69 |ompiling|..and li|
|00000d10| 6e 6b 69 6e 67 20 61 6e | 20 65 78 74 65 72 6e 61 |nking an| externa|
|00000d20| 6c 20 66 75 6e 63 74 69 | 6f 6e 20 76 61 72 69 65 |l functi|on varie|
|00000d30| 73 20 62 79 20 6f 70 65 | 72 61 74 69 6e 67 20 73 |s by ope|rating s|
|00000d40| 79 73 74 65 6d 2e 20 20 | 59 6f 75 0d 0a 73 68 6f |ystem. |You..sho|
|00000d50| 75 6c 64 20 72 65 66 65 | 72 20 74 6f 20 7b 5c 74 |uld refe|r to {\t|
|00000d60| 74 20 54 45 53 54 55 58 | 2e 43 7d 2c 20 77 68 69 |t TESTUX|.C}, whi|
|00000d70| 63 68 20 63 6f 6e 74 61 | 69 6e 73 20 69 6e 66 6f |ch conta|ins info|
|00000d80| 72 6d 61 74 69 6f 6e 20 | 61 62 6f 75 74 0d 0a 63 |rmation |about..c|
|00000d90| 6f 6d 70 69 6c 69 6e 67 | 20 61 6e 64 20 6c 69 6e |ompiling| and lin|
|00000da0| 6b 69 6e 67 20 61 20 75 | 73 65 72 20 65 78 69 74 |king a u|ser exit|
|00000db0| 20 66 6f 72 20 65 61 63 | 68 20 6f 70 65 72 61 74 | for eac|h operat|
|00000dc0| 69 6e 67 20 73 79 73 74 | 65 6d 2e 20 20 4e 6f 74 |ing syst|em. Not|
|00000dd0| 65 0d 0a 74 68 61 74 20 | 79 6f 75 20 63 61 6e 20 |e..that |you can |
|00000de0| 77 72 69 74 65 20 75 73 | 65 72 20 65 78 69 74 73 |write us|er exits|
|00000df0| 20 69 6e 20 61 6e 79 20 | 6c 61 6e 67 75 61 67 65 | in any |language|
|00000e00| 20 74 68 61 74 20 77 69 | 6c 6c 20 73 75 70 70 6f | that wi|ll suppo|
|00000e10| 72 74 20 61 0d 0a 43 2d | 73 74 79 6c 65 20 69 6e |rt a..C-|style in|
|00000e20| 74 65 72 66 61 63 65 3b | 20 79 6f 75 20 6d 61 79 |terface;| you may|
|00000e30| 20 77 69 73 68 20 74 6f | 20 75 73 65 20 61 73 73 | wish to| use ass|
|00000e40| 65 6d 62 6c 79 20 6c 61 | 6e 67 75 61 67 65 20 69 |embly la|nguage i|
|00000e50| 6e 20 70 61 72 74 69 63 | 75 6c 61 72 0d 0a 69 66 |n partic|ular..if|
|00000e60| 20 79 6f 75 72 20 75 73 | 65 72 20 65 78 69 74 20 | your us|er exit |
|00000e70| 6d 75 73 74 20 61 63 63 | 65 73 73 20 79 6f 75 72 |must acc|ess your|
|00000e80| 20 63 6f 6d 70 75 74 65 | 72 27 73 20 68 61 72 64 | compute|r's hard|
|00000e90| 77 61 72 65 2e 20 20 48 | 6f 77 65 76 65 72 2c 20 |ware. H|owever, |
|00000ea0| 77 65 0d 0a 6f 6e 6c 79 | 20 70 72 6f 76 69 64 65 |we..only| provide|
|00000eb0| 20 74 68 65 20 7b 5c 74 | 74 20 54 41 44 53 45 58 | the {\t|t TADSEX|
|00000ec0| 49 54 2e 48 7d 20 64 65 | 66 69 6e 69 74 69 6f 6e |IT.H} de|finition|
|00000ed0| 73 20 66 69 6c 65 20 66 | 6f 72 20 74 68 65 20 5e |s file f|or the ^|
|00000ee0| 7b 43 20 6c 61 6e 67 75 | 61 67 65 7d 2c 0d 0a 61 |{C langu|age},..a|
|00000ef0| 6e 64 20 74 68 65 20 69 | 6e 73 74 72 75 63 74 69 |nd the i|nstructi|
|00000f00| 6f 6e 73 20 69 6e 20 7b | 5c 74 74 20 54 45 53 54 |ons in {|\tt TEST|
|00000f10| 55 58 2e 43 7d 20 61 72 | 65 20 73 70 65 63 69 66 |UX.C} ar|e specif|
|00000f20| 69 63 20 74 6f 20 43 2e | 20 20 49 66 20 79 6f 75 |ic to C.| If you|
|00000f30| 20 77 61 6e 74 0d 0a 74 | 6f 20 75 73 65 20 61 6e | want..t|o use an|
|00000f40| 6f 74 68 65 72 20 6c 61 | 6e 67 75 61 67 65 2c 20 |other la|nguage, |
|00000f50| 79 6f 75 27 6c 6c 20 68 | 61 76 65 20 74 6f 20 62 |you'll h|ave to b|
|00000f60| 65 20 66 61 6d 69 6c 69 | 61 72 20 65 6e 6f 75 67 |e famili|ar enoug|
|00000f70| 68 20 77 69 74 68 20 79 | 6f 75 72 0d 0a 63 6f 6d |h with y|our..com|
|00000f80| 70 69 6c 65 72 20 61 6e | 64 20 6f 70 65 72 61 74 |piler an|d operat|
|00000f90| 69 6e 67 20 73 79 73 74 | 65 6d 20 74 6f 20 62 65 |ing syst|em to be|
|00000fa0| 20 61 62 6c 65 20 74 6f | 20 61 70 70 6c 79 20 74 | able to| apply t|
|00000fb0| 68 65 20 69 6e 73 74 72 | 75 63 74 69 6f 6e 73 0d |he instr|uctions.|
|00000fc0| 0a 77 65 27 76 65 20 70 | 72 6f 76 69 64 65 64 20 |.we've p|rovided |
|00000fd0| 74 6f 20 79 6f 75 72 20 | 6c 61 6e 67 75 61 67 65 |to your |language|
|00000fe0| 2e 0d 0a 0d 0a 0d 0a 5c | 6d 69 6e 6f 72 73 65 63 |.......\|minorsec|
|00000ff0| 74 69 6f 6e 7b 57 72 69 | 74 69 6e 67 20 74 68 65 |tion{Wri|ting the|
|00001000| 20 45 78 74 65 72 6e 61 | 6c 20 46 75 6e 63 74 69 | Externa|l Functi|
|00001010| 6f 6e 7d 0d 0a 0d 0a 49 | 6e 20 67 65 6e 65 72 61 |on}....I|n genera|
|00001020| 6c 2c 20 79 6f 75 20 77 | 72 69 74 65 20 79 6f 75 |l, you w|rite you|
|00001030| 72 20 54 41 44 53 20 75 | 73 65 72 20 65 78 69 74 |r TADS u|ser exit|
|00001040| 20 61 73 20 61 20 72 65 | 67 75 6c 61 72 20 43 20 | as a re|gular C |
|00001050| 66 75 6e 63 74 69 6f 6e | 2e 0d 0a 59 6f 75 20 6d |function|...You m|
|00001060| 75 73 74 20 6e 6f 74 20 | 75 73 65 20 61 6e 79 20 |ust not |use any |
|00001070| 73 74 61 74 69 63 20 6f | 72 20 67 6c 6f 62 61 6c |static o|r global|
|00001080| 20 76 61 72 69 61 62 6c | 65 73 2c 20 62 75 74 20 | variabl|es, but |
|00001090| 79 6f 75 20 63 61 6e 20 | 75 73 65 0d 0a 76 61 72 |you can |use..var|
|000010a0| 69 61 62 6c 65 73 20 6f | 6e 20 74 68 65 20 73 74 |iables o|n the st|
|000010b0| 61 63 6b 2e 20 20 59 6f | 75 20 63 61 6e 27 74 20 |ack. Yo|u can't |
|000010c0| 63 61 6c 6c 20 61 6e 79 | 20 6f 66 20 74 68 65 20 |call any| of the |
|000010d0| 43 20 72 75 6e 2d 74 69 | 6d 65 0d 0a 6c 69 62 72 |C run-ti|me..libr|
|000010e0| 61 72 79 20 66 75 6e 63 | 74 69 6f 6e 73 20 28 73 |ary func|tions (s|
|000010f0| 75 63 68 20 61 73 20 70 | 72 69 6e 74 66 29 20 74 |uch as p|rintf) t|
|00001100| 68 61 74 20 6d 61 79 20 | 75 73 65 20 67 6c 6f 62 |hat may |use glob|
|00001110| 61 6c 20 76 61 72 69 61 | 62 6c 65 73 2e 0d 0a 49 |al varia|bles...I|
|00001120| 66 20 79 6f 75 72 20 66 | 75 6e 63 74 69 6f 6e 20 |f your f|unction |
|00001130| 6f 72 20 61 6e 79 20 66 | 75 6e 63 74 69 6f 6e 20 |or any f|unction |
|00001140| 69 74 20 63 61 6c 6c 73 | 20 75 73 65 73 20 67 6c |it calls| uses gl|
|00001150| 6f 62 61 6c 20 76 61 72 | 69 61 62 6c 65 73 2c 0d |obal var|iables,.|
|00001160| 0a 74 68 65 20 72 65 73 | 75 6c 74 73 20 77 69 6c |.the res|ults wil|
|00001170| 6c 20 62 65 20 75 6e 70 | 72 65 64 69 63 74 61 62 |l be unp|redictab|
|00001180| 6c 65 2c 20 61 6e 64 20 | 79 6f 75 20 6d 61 79 20 |le, and |you may |
|00001190| 63 72 61 73 68 20 74 68 | 65 20 6d 61 63 68 69 6e |crash th|e machin|
|000011a0| 65 2e 0d 0a 0d 0a 28 4e | 6f 74 65 20 74 68 61 74 |e.....(N|ote that|
|000011b0| 20 74 68 65 20 70 72 6f | 68 69 62 69 74 69 6f 6e | the pro|hibition|
|000011c0| 20 6f 66 20 73 74 61 74 | 69 63 20 61 6e 64 20 67 | of stat|ic and g|
|000011d0| 6c 6f 62 61 6c 20 76 61 | 72 69 61 62 6c 65 73 20 |lobal va|riables |
|000011e0| 69 73 20 61 0d 0a 73 69 | 6d 70 6c 69 66 69 63 61 |is a..si|mplifica|
|000011f0| 74 69 6f 6e 2e 20 20 49 | 6e 20 61 63 74 75 61 6c |tion. I|n actual|
|00001200| 69 74 79 2c 20 79 6f 75 | 20 63 61 6e 20 75 73 65 |ity, you| can use|
|00001210| 20 67 6c 6f 62 61 6c 73 | 20 6f 6e 20 6d 6f 73 74 | globals| on most|
|00001220| 20 73 79 73 74 65 6d 73 | 0d 0a 75 6e 64 65 72 20 | systems|..under |
|00001230| 73 70 65 63 69 66 69 63 | 20 63 6f 6e 64 69 74 69 |specific| conditi|
|00001240| 6f 6e 73 2e 20 20 4f 6e | 20 4d 53 2d 44 4f 53 2c |ons. On| MS-DOS,|
|00001250| 20 41 74 61 72 69 20 53 | 54 2c 20 61 6e 64 20 4d | Atari S|T, and M|
|00001260| 61 63 69 6e 74 6f 73 68 | 2c 20 79 6f 75 0d 0a 63 |acintosh|, you..c|
|00001270| 61 6e 20 75 73 65 20 67 | 6c 6f 62 61 6c 20 76 61 |an use g|lobal va|
|00001280| 72 69 61 62 6c 65 73 20 | 61 73 20 6c 6f 6e 67 20 |riables |as long |
|00001290| 61 73 20 74 68 65 79 20 | 61 72 65 20 50 43 2d 72 |as they |are PC-r|
|000012a0| 65 6c 61 74 69 76 65 2d | 2d 2d 74 68 61 74 20 69 |elative-|--that i|
|000012b0| 73 2c 0d 0a 74 68 65 79 | 20 6d 75 73 74 20 62 65 |s,..they| must be|
|000012c0| 20 63 6f 6e 74 61 69 6e | 65 64 20 69 6e 20 74 68 | contain|ed in th|
|000012d0| 65 20 73 61 6d 65 20 70 | 72 6f 67 72 61 6d 20 73 |e same p|rogram s|
|000012e0| 65 63 74 69 6f 6e 20 61 | 73 20 74 68 65 20 6f 62 |ection a|s the ob|
|000012f0| 6a 65 63 74 20 63 6f 64 | 65 0d 0a 6f 66 20 79 6f |ject cod|e..of yo|
|00001300| 75 72 20 75 73 65 72 20 | 65 78 69 74 20 61 6e 64 |ur user |exit and|
|00001310| 20 6d 75 73 74 20 62 65 | 20 61 64 64 72 65 73 73 | must be| address|
|00001320| 65 64 20 75 73 69 6e 67 | 20 74 68 65 20 70 72 6f |ed using| the pro|
|00001330| 67 72 61 6d 20 63 6f 75 | 6e 74 65 72 2e 0d 0a 49 |gram cou|nter...I|
|00001340| 66 20 79 6f 75 20 61 72 | 65 20 66 61 6d 69 6c 69 |f you ar|e famili|
|00001350| 61 72 20 65 6e 6f 75 67 | 68 20 77 69 74 68 20 79 |ar enoug|h with y|
|00001360| 6f 75 72 20 63 6f 6d 70 | 69 6c 65 72 20 74 6f 20 |our comp|iler to |
|00001370| 6b 6e 6f 77 20 68 6f 77 | 20 74 6f 20 67 65 6e 65 |know how| to gene|
|00001380| 72 61 74 65 0d 0a 50 43 | 2d 72 65 6c 61 74 69 76 |rate..PC|-relativ|
|00001390| 65 20 73 74 61 74 69 63 | 20 76 61 72 69 61 62 6c |e static| variabl|
|000013a0| 65 73 2c 20 77 68 69 63 | 68 20 6d 6f 73 74 20 63 |es, whic|h most c|
|000013b0| 6f 6d 70 69 6c 65 72 73 | 20 6f 6e 20 74 68 65 73 |ompilers| on thes|
|000013c0| 65 20 73 79 73 74 65 6d | 73 0d 0a 63 61 6e 20 64 |e system|s..can d|
|000013d0| 6f 20 77 68 65 6e 20 70 | 72 65 73 65 6e 74 65 64 |o when p|resented|
|000013e0| 20 77 69 74 68 20 74 68 | 65 20 63 6f 72 72 65 63 | with th|e correc|
|000013f0| 74 20 63 6f 6d 62 69 6e | 61 74 69 6f 6e 20 6f 66 |t combin|ation of|
|00001400| 20 73 65 63 72 65 74 20 | 6f 70 74 69 6f 6e 73 2c | secret |options,|
|00001410| 0d 0a 79 6f 75 20 73 68 | 6f 75 6c 64 20 62 65 20 |..you sh|ould be |
|00001420| 61 62 6c 65 20 74 6f 20 | 75 73 65 20 73 74 61 74 |able to |use stat|
|00001430| 69 63 20 76 61 72 69 61 | 62 6c 65 73 20 77 69 74 |ic varia|bles wit|
|00001440| 68 6f 75 74 20 61 6e 79 | 20 68 61 72 6d 2e 20 20 |hout any| harm. |
|00001450| 45 78 61 63 74 6c 79 0d | 0a 68 6f 77 20 79 6f 75 |Exactly.|.how you|
|00001460| 20 67 6f 20 61 62 6f 75 | 74 20 64 6f 69 6e 67 20 | go abou|t doing |
|00001470| 74 68 69 73 20 77 69 74 | 68 20 79 6f 75 72 20 63 |this wit|h your c|
|00001480| 6f 6d 70 69 6c 65 72 20 | 69 73 2c 20 6f 62 76 69 |ompiler |is, obvi|
|00001490| 6f 75 73 6c 79 2c 20 62 | 65 79 6f 6e 64 0d 0a 74 |ously, b|eyond..t|
|000014a0| 68 65 20 73 63 6f 70 65 | 20 6f 66 20 74 68 69 73 |he scope| of this|
|000014b0| 20 61 70 70 65 6e 64 69 | 78 2e 29 0d 0a 0d 0a 54 | appendi|x.)....T|
|000014c0| 68 65 20 66 69 72 73 74 | 20 74 68 69 6e 67 20 69 |he first| thing i|
|000014d0| 6e 20 74 68 65 20 43 20 | 70 72 6f 67 72 61 6d 20 |n the C |program |
|000014e0| 74 68 61 74 20 63 6f 6e | 74 61 69 6e 73 20 79 6f |that con|tains yo|
|000014f0| 75 72 20 75 73 65 72 20 | 65 78 69 74 20 73 68 6f |ur user |exit sho|
|00001500| 75 6c 64 0d 0a 62 65 20 | 61 20 7b 5c 74 74 20 5c |uld..be |a {\tt \|
|00001510| 23 69 6e 63 6c 75 64 65 | 7d 20 64 69 72 65 63 74 |#include|} direct|
|00001520| 69 76 65 20 6c 69 6b 65 | 20 74 68 69 73 3a 0d 0a |ive like| this:..|
|00001530| 5e 5e 7b 54 41 44 53 45 | 58 49 54 2e 48 7d 0d 0a |^^{TADSE|XIT.H}..|
|00001540| 0d 0a 7b 5c 65 78 61 6d | 70 6c 65 0d 0a 5c 23 69 |..{\exam|ple..\#i|
|00001550| 6e 63 6c 75 64 65 20 3c | 74 61 64 73 65 78 69 74 |nclude <|tadsexit|
|00001560| 2e 68 3e 0d 0a 7d 0d 0a | 0d 0a 54 68 69 73 20 69 |.h>..}..|..This i|
|00001570| 6e 73 65 72 74 73 20 74 | 68 65 20 68 65 61 64 65 |nserts t|he heade|
|00001580| 72 20 66 69 6c 65 20 7b | 5c 74 74 20 74 61 64 73 |r file {|\tt tads|
|00001590| 65 78 69 74 2e 68 7d 20 | 28 77 68 69 63 68 20 69 |exit.h} |(which i|
|000015a0| 73 20 70 61 72 74 20 6f | 66 20 74 68 65 0d 0a 54 |s part o|f the..T|
|000015b0| 41 44 53 20 73 6f 66 74 | 77 61 72 65 29 20 69 6e |ADS soft|ware) in|
|000015c0| 74 6f 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 63 |to the c|urrent c|
|000015d0| 6f 6d 70 69 6c 61 74 69 | 6f 6e 20 75 6e 69 74 2e |ompilati|on unit.|
|000015e0| 20 20 54 68 69 73 20 66 | 69 6c 65 20 64 65 66 69 | This f|ile defi|
|000015f0| 6e 65 73 0d 0a 74 68 65 | 20 69 6e 74 65 72 66 61 |nes..the| interfa|
|00001600| 63 65 20 62 65 74 77 65 | 65 6e 20 54 41 44 53 20 |ce betwe|en TADS |
|00001610| 61 6e 64 20 79 6f 75 72 | 20 75 73 65 72 20 65 78 |and your| user ex|
|00001620| 69 74 20 70 72 6f 67 72 | 61 6d 20 77 69 74 68 20 |it progr|am with |
|00001630| 61 20 73 65 74 0d 0a 6f | 66 20 65 61 73 79 2d 74 |a set..o|f easy-t|
|00001640| 6f 2d 75 73 65 20 6d 61 | 63 72 6f 73 2e 20 20 55 |o-use ma|cros. U|
|00001650| 73 69 6e 67 20 74 68 65 | 73 65 20 6d 61 63 72 6f |sing the|se macro|
|00001660| 73 2c 20 79 6f 75 20 64 | 6f 6e 27 74 20 6e 65 65 |s, you d|on't nee|
|00001670| 64 20 74 6f 20 62 65 0d | 0a 61 77 61 72 65 20 6f |d to be.|.aware o|
|00001680| 66 20 74 68 65 20 73 74 | 72 61 6e 67 65 20 64 65 |f the st|range de|
|00001690| 74 61 69 6c 73 20 6f 66 | 20 74 68 65 20 64 61 74 |tails of| the dat|
|000016a0| 61 20 73 74 72 75 63 74 | 75 72 65 73 20 61 6e 64 |a struct|ures and|
|000016b0| 20 63 61 6c 6c 69 6e 67 | 0d 0a 73 65 71 75 65 6e | calling|..sequen|
|000016c0| 63 65 73 20 74 68 61 74 | 20 54 41 44 53 20 75 73 |ces that| TADS us|
|000016d0| 65 73 20 74 6f 20 63 61 | 6c 6c 20 79 6f 75 72 20 |es to ca|ll your |
|000016e0| 75 73 65 72 20 65 78 69 | 74 20 61 6e 64 20 76 69 |user exi|t and vi|
|000016f0| 63 65 20 76 65 72 73 61 | 2e 0d 0a 0d 0a 57 68 61 |ce versa|.....Wha|
|00001700| 74 65 76 65 72 20 79 6f | 75 20 63 61 6c 6c 20 79 |tever yo|u call y|
|00001710| 6f 75 72 20 75 73 65 72 | 20 65 78 69 74 20 77 69 |our user| exit wi|
|00001720| 74 68 20 74 68 65 20 7b | 5c 74 74 20 65 78 74 65 |th the {|\tt exte|
|00001730| 72 6e 61 6c 20 66 75 6e | 63 74 69 6f 6e 7d 0d 0a |rnal fun|ction}..|
|00001740| 64 65 63 6c 61 72 61 74 | 69 6f 6e 20 69 6e 20 79 |declarat|ion in y|
|00001750| 6f 75 72 20 54 41 44 53 | 20 70 72 6f 67 72 61 6d |our TADS| program|
|00001760| 2c 20 74 68 65 20 75 73 | 65 72 20 65 78 69 74 20 |, the us|er exit |
|00001770| 69 6e 20 79 6f 75 72 20 | 43 20 70 72 6f 67 72 61 |in your |C progra|
|00001780| 6d 0d 0a 69 73 20 63 61 | 6c 6c 65 64 20 7b 5c 74 |m..is ca|lled {\t|
|00001790| 74 20 6d 61 69 6e 7d 2e | 20 20 59 6f 75 20 64 65 |t main}.| You de|
|000017a0| 63 6c 61 72 65 20 69 74 | 20 6c 69 6b 65 20 74 68 |clare it| like th|
|000017b0| 69 73 3a 0d 0a 0d 0a 7b | 5c 65 78 61 6d 70 6c 65 |is:....{|\example|
|000017c0| 0d 0a 20 20 69 6e 74 20 | 6d 61 69 6e 28 63 74 78 |.. int |main(ctx|
|000017d0| 29 0d 0a 20 20 74 61 64 | 73 75 78 64 65 66 20 66 |).. tad|suxdef f|
|000017e0| 61 72 20 2a 63 74 78 3b | 0d 0a 20 20 5c 6c 62 0d |ar *ctx;|.. \lb.|
|000017f0| 0a 7d 0d 0a 0d 0a 59 6f | 75 20 6d 61 79 20 68 61 |.}....Yo|u may ha|
|00001800| 76 65 20 74 77 6f 20 77 | 6f 72 72 69 65 73 20 61 |ve two w|orries a|
|00001810| 74 20 74 68 69 73 20 70 | 6f 69 6e 74 2e 20 20 46 |t this p|oint. F|
|00001820| 69 72 73 74 2c 20 69 66 | 20 74 68 65 20 43 20 70 |irst, if| the C p|
|00001830| 72 6f 67 72 61 6d 0d 0a | 63 61 6c 6c 73 20 74 68 |rogram..|calls th|
|00001840| 65 20 66 75 6e 63 74 69 | 6f 6e 20 7b 5c 74 74 20 |e functi|on {\tt |
|00001850| 6d 61 69 6e 7d 2c 20 68 | 6f 77 20 64 6f 65 73 20 |main}, h|ow does |
|00001860| 54 41 44 53 20 6b 6e 6f | 77 20 74 6f 20 63 61 6c |TADS kno|w to cal|
|00001870| 6c 20 69 74 20 77 68 65 | 6e 0d 0a 79 6f 75 20 63 |l it whe|n..you c|
|00001880| 61 6c 6c 20 7b 5c 74 74 | 20 6d 79 65 78 69 74 7d |all {\tt| myexit}|
|00001890| 20 66 72 6f 6d 20 79 6f | 75 72 20 67 61 6d 65 20 | from yo|ur game |
|000018a0| 70 72 6f 67 72 61 6d 3f | 20 20 53 65 63 6f 6e 64 |program?| Second|
|000018b0| 2c 20 69 66 20 79 6f 75 | 20 77 61 6e 74 0d 0a 74 |, if you| want..t|
|000018c0| 6f 20 63 61 6c 6c 20 6d | 6f 72 65 20 74 68 61 6e |o call m|ore than|
|000018d0| 20 6f 6e 65 20 75 73 65 | 72 20 65 78 69 74 20 66 | one use|r exit f|
|000018e0| 72 6f 6d 20 79 6f 75 72 | 20 67 61 6d 65 20 70 72 |rom your| game pr|
|000018f0| 6f 67 72 61 6d 2c 20 68 | 6f 77 20 63 61 6e 20 74 |ogram, h|ow can t|
|00001900| 68 65 79 0d 0a 62 6f 74 | 68 20 62 65 20 6e 61 6d |hey..bot|h be nam|
|00001910| 65 64 20 7b 5c 74 74 20 | 6d 61 69 6e 7d 3f 0d 0a |ed {\tt |main}?..|
|00001920| 0d 0a 54 68 65 20 61 6e | 73 77 65 72 20 74 6f 20 |..The an|swer to |
|00001930| 62 6f 74 68 20 71 75 65 | 73 74 69 6f 6e 73 20 69 |both que|stions i|
|00001940| 73 20 74 68 61 74 20 54 | 41 44 53 20 6c 65 61 72 |s that T|ADS lear|
|00001950| 6e 73 20 74 68 65 20 6e | 61 6d 65 20 6f 66 20 79 |ns the n|ame of y|
|00001960| 6f 75 72 20 75 73 65 72 | 0d 0a 65 78 69 74 20 6e |our user|..exit n|
|00001970| 6f 74 20 66 72 6f 6d 20 | 74 68 65 20 43 20 63 6f |ot from |the C co|
|00001980| 6d 70 69 6c 65 72 20 28 | 77 68 69 63 68 20 6f 6e |mpiler (|which on|
|00001990| 6c 79 20 6b 6e 6f 77 73 | 20 74 68 65 20 66 75 6e |ly knows| the fun|
|000019a0| 63 74 69 6f 6e 20 61 73 | 20 7b 5c 74 74 20 6d 61 |ction as| {\tt ma|
|000019b0| 69 6e 7d 29 2c 0d 0a 62 | 75 74 20 66 72 6f 6d 20 |in}),..b|ut from |
|000019c0| 61 20 60 60 72 65 73 6f | 75 72 63 65 20 65 64 69 |a ``reso|urce edi|
|000019d0| 74 6f 72 2e 27 27 20 20 | 4f 6e 20 4d 53 2d 44 4f |tor.'' |On MS-DO|
|000019e0| 53 20 61 6e 64 20 41 74 | 61 72 69 20 53 54 20 73 |S and At|ari ST s|
|000019f0| 79 73 74 65 6d 73 2c 20 | 74 68 69 73 0d 0a 5e 7b |ystems, |this..^{|
|00001a00| 72 65 73 6f 75 72 63 65 | 20 65 64 69 74 6f 72 7d |resource| editor}|
|00001a10| 20 69 73 20 63 61 6c 6c | 65 64 20 5e 7b 54 41 44 | is call|ed ^{TAD|
|00001a20| 53 52 53 43 7d 2c 20 61 | 6e 64 20 69 73 20 70 72 |SRSC}, a|nd is pr|
|00001a30| 6f 76 69 64 65 64 20 77 | 69 74 68 20 74 68 65 0d |ovided w|ith the.|
|00001a40| 0a 54 41 44 53 20 73 6f | 66 74 77 61 72 65 3b 0d |.TADS so|ftware;.|
|00001a50| 0a 72 65 66 65 72 20 74 | 6f 20 74 68 65 20 64 6f |.refer t|o the do|
|00001a60| 63 75 6d 65 6e 74 61 74 | 69 6f 6e 20 69 6e 20 74 |cumentat|ion in t|
|00001a70| 68 65 20 66 69 6c 65 20 | 7b 5c 74 74 20 54 45 53 |he file |{\tt TES|
|00001a80| 54 55 58 2e 43 7d 20 66 | 6f 72 20 69 6e 66 6f 72 |TUX.C} f|or infor|
|00001a90| 6d 61 74 69 6f 6e 20 6f | 6e 0d 0a 68 6f 77 20 74 |mation o|n..how t|
|00001aa0| 6f 20 75 73 65 20 54 41 | 44 53 52 53 43 2e 20 20 |o use TA|DSRSC. |
|00001ab0| 4f 6e 20 4d 61 63 69 6e | 74 6f 73 68 20 73 79 73 |On Macin|tosh sys|
|00001ac0| 74 65 6d 73 2c 20 79 6f | 75 20 73 68 6f 75 6c 64 |tems, yo|u should|
|00001ad0| 20 75 73 65 20 61 20 73 | 74 61 6e 64 61 72 64 0d | use a s|tandard.|
|00001ae0| 0a 72 65 73 6f 75 72 63 | 65 20 65 64 69 74 6f 72 |.resourc|e editor|
|00001af0| 2c 20 73 75 63 68 20 61 | 73 20 52 65 73 45 64 69 |, such a|s ResEdi|
|00001b00| 74 2c 20 77 68 69 63 68 | 20 73 68 6f 75 6c 64 20 |t, which| should |
|00001b10| 62 65 20 70 61 63 6b 61 | 67 65 64 20 77 69 74 68 |be packa|ged with|
|00001b20| 20 79 6f 75 72 0d 0a 43 | 20 70 72 6f 67 72 61 6d | your..C| program|
|00001b30| 6d 69 6e 67 20 74 6f 6f | 6c 73 2e 0d 0a 0d 0a 49 |ming too|ls.....I|
|00001b40| 6e 20 61 6e 79 20 63 61 | 73 65 2c 20 65 61 63 68 |n any ca|se, each|
|00001b50| 20 75 73 65 72 20 65 78 | 69 74 20 69 73 20 63 6f | user ex|it is co|
|00001b60| 6d 70 69 6c 65 64 20 73 | 65 70 61 72 61 74 65 6c |mpiled s|eparatel|
|00001b70| 79 2c 0d 0a 77 68 69 63 | 68 20 6d 65 61 6e 73 20 |y,..whic|h means |
|00001b80| 74 68 61 74 20 79 6f 75 | 20 63 61 6e 20 68 61 76 |that you| can hav|
|00001b90| 65 20 61 73 20 6d 61 6e | 79 20 61 73 20 79 6f 75 |e as man|y as you|
|00001ba0| 20 77 61 6e 74 2d 2d 2d | 61 6c 6c 20 6e 61 6d 65 | want---|all name|
|00001bb0| 64 0d 0a 7b 5c 74 74 20 | 6d 61 69 6e 7d 2d 2d 2d |d..{\tt |main}---|
|00001bc0| 77 69 74 68 6f 75 74 20 | 79 6f 75 72 20 43 20 63 |without |your C c|
|00001bd0| 6f 6d 70 69 6c 65 72 20 | 6f 72 20 54 41 44 53 20 |ompiler |or TADS |
|00001be0| 62 65 63 6f 6d 69 6e 67 | 20 63 6f 6e 66 75 73 65 |becoming| confuse|
|00001bf0| 64 20 61 62 6f 75 74 0d | 0a 61 6c 6c 20 74 68 65 |d about.|.all the|
|00001c00| 20 69 64 65 6e 74 69 63 | 61 6c 20 6e 61 6d 65 73 | identic|al names|
|00001c10| 2e 20 20 55 73 69 6e 67 | 20 74 68 65 20 72 65 73 |. Using| the res|
|00001c20| 6f 75 72 63 65 20 65 64 | 69 74 6f 72 2c 20 79 6f |ource ed|itor, yo|
|00001c30| 75 20 61 64 64 20 65 61 | 63 68 0d 0a 73 65 70 61 |u add ea|ch..sepa|
|00001c40| 72 61 74 65 6c 79 20 63 | 6f 6d 70 69 6c 65 64 20 |rately c|ompiled |
|00001c50| 75 73 65 72 20 65 78 69 | 74 20 74 6f 20 79 6f 75 |user exi|t to you|
|00001c60| 72 20 67 61 6d 65 20 70 | 72 6f 67 72 61 6d 2c 20 |r game p|rogram, |
|00001c70| 61 73 73 69 67 6e 69 6e | 67 20 74 68 65 0d 0a 72 |assignin|g the..r|
|00001c80| 65 73 6f 75 72 63 65 20 | 74 68 65 20 6e 61 6d 65 |esource |the name|
|00001c90| 20 74 68 61 74 20 79 6f | 75 20 75 73 65 20 69 6e | that yo|u use in|
|00001ca0| 20 79 6f 75 72 20 7b 5c | 74 74 20 65 78 74 65 72 | your {\|tt exter|
|00001cb0| 6e 61 6c 20 66 75 6e 63 | 74 69 6f 6e 7d 0d 0a 64 |nal func|tion}..d|
|00001cc0| 65 63 6c 61 72 61 74 69 | 6f 6e 2e 20 20 54 68 65 |eclarati|on. The|
|00001cd0| 20 69 6d 70 6f 72 74 61 | 6e 74 20 74 68 69 6e 67 | importa|nt thing|
|00001ce0| 20 69 73 20 74 68 61 74 | 20 74 68 65 20 72 65 73 | is that| the res|
|00001cf0| 6f 75 72 63 65 20 6e 61 | 6d 65 20 64 65 66 69 6e |ource na|me defin|
|00001d00| 65 64 0d 0a 77 69 74 68 | 20 74 68 65 20 72 65 73 |ed..with| the res|
|00001d10| 6f 75 72 63 65 20 65 64 | 69 74 6f 72 20 6d 61 74 |ource ed|itor mat|
|00001d20| 63 68 65 73 20 74 68 65 | 20 6e 61 6d 65 20 64 65 |ches the| name de|
|00001d30| 63 6c 61 72 65 64 20 69 | 6e 20 74 68 65 20 7b 5c |clared i|n the {\|
|00001d40| 74 74 20 65 78 74 65 72 | 6e 61 6c 0d 0a 66 75 6e |tt exter|nal..fun|
|00001d50| 63 74 69 6f 6e 7d 20 73 | 74 61 74 65 6d 65 6e 74 |ction} s|tatement|
|00001d60| 2e 0d 0a 0d 0a 54 68 65 | 20 61 72 67 75 6d 65 6e |.....The| argumen|
|00001d70| 74 20 74 6f 20 74 68 65 | 20 66 75 6e 63 74 69 6f |t to the| functio|
|00001d80| 6e 20 7b 5c 74 74 20 6d | 61 69 6e 7d 20 69 73 20 |n {\tt m|ain} is |
|00001d90| 6e 6f 74 20 74 68 65 20 | 61 72 67 75 6d 65 6e 74 |not the |argument|
|00001da0| 20 74 68 61 74 0d 0a 79 | 6f 75 20 70 72 6f 76 69 | that..y|ou provi|
|00001db0| 64 65 64 20 69 6e 20 74 | 68 65 20 69 6e 76 6f 63 |ded in t|he invoc|
|00001dc0| 61 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 75 73 65 |ation of| the use|
|00001dd0| 72 20 65 78 69 74 20 69 | 6e 20 79 6f 75 72 20 54 |r exit i|n your T|
|00001de0| 41 44 53 20 70 72 6f 67 | 72 61 6d 2e 0d 0a 49 6e |ADS prog|ram...In|
|00001df0| 73 74 65 61 64 2c 20 69 | 74 20 69 73 20 61 20 60 |stead, i|t is a `|
|00001e00| 60 63 6f 6e 74 65 78 74 | 2c 27 27 20 77 68 69 63 |`context|,'' whic|
|00001e10| 68 20 79 6f 75 20 75 73 | 65 20 66 6f 72 20 63 6f |h you us|e for co|
|00001e20| 6d 6d 75 6e 69 63 61 74 | 69 6f 6e 73 20 77 69 74 |mmunicat|ions wit|
|00001e30| 68 0d 0a 54 41 44 53 2e | 20 20 59 6f 75 20 75 73 |h..TADS.| You us|
|00001e40| 65 20 74 68 69 73 20 63 | 6f 6e 74 65 78 74 20 61 |e this c|ontext a|
|00001e50| 72 67 75 6d 65 6e 74 20 | 74 6f 20 6f 62 74 61 69 |rgument |to obtai|
|00001e60| 6e 20 74 68 65 20 61 63 | 74 75 61 6c 20 61 72 67 |n the ac|tual arg|
|00001e70| 75 6d 65 6e 74 73 0d 0a | 74 6f 20 79 6f 75 72 20 |uments..|to your |
|00001e80| 75 73 65 72 20 65 78 69 | 74 20 66 75 6e 63 74 69 |user exi|t functi|
|00001e90| 6f 6e 2e 0d 0a 0d 0a 41 | 6c 6c 20 6f 66 20 79 6f |on.....A|ll of yo|
|00001ea0| 75 72 20 61 72 67 75 6d | 65 6e 74 73 0d 0a 61 72 |ur argum|ents..ar|
|00001eb0| 65 20 6f 6e 20 61 20 60 | 60 73 74 61 63 6b 2c 27 |e on a `|`stack,'|
|00001ec0| 27 20 77 68 69 63 68 20 | 6d 65 61 6e 73 20 74 68 |' which |means th|
|00001ed0| 61 74 20 79 6f 75 20 63 | 61 6e 20 67 65 74 20 74 |at you c|an get t|
|00001ee0| 6f 20 74 68 65 6d 20 6f | 6e 65 20 61 74 0d 0a 61 |o them o|ne at..a|
|00001ef0| 20 74 69 6d 65 2e 20 20 | 46 69 72 73 74 2c 20 79 | time. |First, y|
|00001f00| 6f 75 20 63 61 6c 6c 20 | 74 68 65 20 66 75 6e 63 |ou call |the func|
|00001f10| 74 69 6f 6e 20 7b 5c 74 | 74 20 74 61 64 73 5c 5f |tion {\t|t tads\_|
|00001f20| 74 6f 73 74 79 70 28 63 | 74 78 29 7d 20 74 6f 0d |tostyp(c|tx)} to.|
|00001f30| 0a 6c 65 61 72 6e 20 74 | 68 65 20 7b 5c 69 74 20 |.learn t|he {\it |
|00001f40| 74 79 70 65 7d 20 6f 66 | 20 74 68 65 20 66 69 72 |type} of| the fir|
|00001f50| 73 74 20 61 72 67 75 6d | 65 6e 74 2e 20 20 54 68 |st argum|ent. Th|
|00001f60| 69 73 20 72 65 74 75 72 | 6e 73 20 6f 6e 65 20 6f |is retur|ns one o|
|00001f70| 66 0d 0a 74 68 65 73 65 | 20 76 61 6c 75 65 73 20 |f..these| values |
|00001f80| 28 64 65 66 69 6e 65 64 | 20 69 6e 20 7b 5c 74 74 |(defined| in {\tt|
|00001f90| 20 54 41 44 53 45 58 49 | 54 2e 48 7d 29 3a 20 20 | TADSEXI|T.H}): |
|00001fa0| 7b 5c 74 74 20 54 41 44 | 53 5c 5f 4e 55 4d 42 45 |{\tt TAD|S\_NUMBE|
|00001fb0| 52 7d 2c 0d 0a 69 6e 64 | 69 63 61 74 69 6e 67 20 |R},..ind|icating |
|00001fc0| 74 68 65 20 61 72 67 75 | 6d 65 6e 74 20 69 73 20 |the argu|ment is |
|00001fd0| 61 20 6c 6f 6e 67 0d 0a | 69 6e 74 65 67 65 72 3b |a long..|integer;|
|00001fe0| 20 7b 5c 74 74 20 54 41 | 44 53 5c 5f 53 54 52 49 | {\tt TA|DS\_STRI|
|00001ff0| 4e 47 7d 2c 20 69 6e 64 | 69 63 61 74 69 6e 67 20 |NG}, ind|icating |
|00002000| 74 68 65 20 61 72 67 75 | 6d 65 6e 74 20 69 73 20 |the argu|ment is |
|00002010| 61 0d 0a 28 73 69 6e 67 | 6c 65 2d 71 75 6f 74 65 |a..(sing|le-quote|
|00002020| 64 29 20 73 74 72 69 6e | 67 3b 20 7b 5c 74 74 20 |d) strin|g; {\tt |
|00002030| 54 41 44 53 5c 5f 4e 49 | 4c 7d 20 6f 72 20 7b 5c |TADS\_NI|L} or {\|
|00002040| 74 74 20 54 41 44 53 5c | 5f 54 52 55 45 7d 2c 20 |tt TADS\|_TRUE}, |
|00002050| 69 6e 64 69 63 61 74 69 | 6e 67 0d 0a 6f 6e 65 20 |indicati|ng..one |
|00002060| 6f 66 20 74 68 65 20 74 | 72 75 74 68 20 76 61 6c |of the t|ruth val|
|00002070| 75 65 73 2e 0d 0a 59 6f | 75 20 63 61 6e 6e 6f 74 |ues...Yo|u cannot|
|00002080| 20 70 61 73 73 20 6f 74 | 68 65 72 20 74 79 70 65 | pass ot|her type|
|00002090| 73 20 6f 66 20 76 61 6c | 75 65 73 20 74 6f 20 75 |s of val|ues to u|
|000020a0| 73 65 72 20 65 78 69 74 | 73 2c 20 62 65 63 61 75 |ser exit|s, becau|
|000020b0| 73 65 0d 0a 74 68 65 20 | 75 73 65 72 20 65 78 69 |se..the |user exi|
|000020c0| 74 73 20 77 6f 75 6c 64 | 6e 27 74 20 6b 6e 6f 77 |ts would|n't know|
|000020d0| 20 77 68 61 74 20 74 6f | 20 64 6f 20 77 69 74 68 | what to| do with|
|000020e0| 20 6f 74 68 65 72 20 74 | 79 70 65 73 2e 0d 0a 0d | other t|ypes....|
|000020f0| 0a 4e 65 78 74 2c 20 79 | 6f 75 20 72 65 74 72 69 |.Next, y|ou retri|
|00002100| 65 76 65 20 74 68 65 20 | 66 69 72 73 74 20 61 72 |eve the |first ar|
|00002110| 67 75 6d 65 6e 74 20 66 | 72 6f 6d 20 74 68 65 20 |gument f|rom the |
|00002120| 73 74 61 63 6b 20 62 79 | 20 63 61 6c 6c 69 6e 67 |stack by| calling|
|00002130| 20 74 68 65 0d 0a 66 75 | 6e 63 74 69 6f 6e 20 61 | the..fu|nction a|
|00002140| 70 70 72 6f 70 72 69 61 | 74 65 20 74 6f 20 69 74 |ppropria|te to it|
|00002150| 73 20 74 79 70 65 3a 20 | 20 7b 5c 74 74 20 74 61 |s type: | {\tt ta|
|00002160| 64 73 5c 5f 70 6f 70 6e | 75 6d 28 63 74 78 29 7d |ds\_popn|um(ctx)}|
|00002170| 20 66 6f 72 20 6e 75 6d | 62 65 72 73 2c 0d 0a 7b | for num|bers,..{|
|00002180| 5c 74 74 20 74 61 64 73 | 5c 5f 70 6f 70 73 74 72 |\tt tads|\_popstr|
|00002190| 28 63 74 78 29 7d 20 66 | 6f 72 20 73 74 72 69 6e |(ctx)} f|or strin|
|000021a0| 67 73 2c 20 6f 72 20 6a | 75 73 74 0d 0a 7b 5c 74 |gs, or j|ust..{\t|
|000021b0| 74 20 74 61 64 73 5c 5f | 70 6f 70 28 63 74 78 29 |t tads\_|pop(ctx)|
|000021c0| 7d 20 66 6f 72 0d 0a 74 | 72 75 74 68 20 76 61 6c |} for..t|ruth val|
|000021d0| 75 65 73 2e 20 20 54 68 | 69 73 20 6c 61 73 74 20 |ues. Th|is last |
|000021e0| 66 75 6e 63 74 69 6f 6e | 20 68 61 73 20 6e 6f 20 |function| has no |
|000021f0| 72 65 74 75 72 6e 20 76 | 61 6c 75 65 2c 20 62 65 |return v|alue, be|
|00002200| 63 61 75 73 65 20 61 6c | 6c 0d 0a 79 6f 75 20 6e |cause al|l..you n|
|00002210| 65 65 64 20 74 6f 20 6b | 6e 6f 77 20 69 73 20 74 |eed to k|now is t|
|00002220| 68 65 20 74 79 70 65 20 | 28 74 72 75 65 20 6f 72 |he type |(true or|
|00002230| 20 6e 69 6c 29 2c 20 62 | 75 74 20 79 6f 75 20 73 | nil), b|ut you s|
|00002240| 74 69 6c 6c 20 6d 75 73 | 74 20 63 61 6c 6c 0d 0a |till mus|t call..|
|00002250| 69 74 20 74 6f 20 72 65 | 6d 6f 76 65 20 74 68 65 |it to re|move the|
|00002260| 20 61 72 67 75 6d 65 6e | 74 20 66 72 6f 6d 20 74 | argumen|t from t|
|00002270| 68 65 20 73 74 61 63 6b | 3b 20 74 68 65 20 6f 74 |he stack|; the ot|
|00002280| 68 65 72 20 74 77 6f 20 | 66 75 6e 63 74 69 6f 6e |her two |function|
|00002290| 73 0d 0a 72 65 74 75 72 | 6e 20 65 69 74 68 65 72 |s..retur|n either|
|000022a0| 20 61 20 6c 6f 6e 67 20 | 69 6e 74 65 67 65 72 20 | a long |integer |
|000022b0| 6f 72 20 61 20 73 74 72 | 69 6e 67 20 64 65 73 63 |or a str|ing desc|
|000022c0| 72 69 70 74 6f 72 2c 20 | 72 65 73 70 65 63 74 69 |riptor, |respecti|
|000022d0| 76 65 6c 79 2e 0d 0a 0d | 0a 54 68 65 20 72 65 74 |vely....|.The ret|
|000022e0| 75 72 6e 20 76 61 6c 75 | 65 20 6f 66 20 74 68 65 |urn valu|e of the|
|000022f0| 20 7b 5c 74 74 20 74 61 | 64 73 5c 5f 70 6f 70 73 | {\tt ta|ds\_pops|
|00002300| 74 72 28 63 74 78 29 7d | 20 66 75 6e 63 74 69 6f |tr(ctx)}| functio|
|00002310| 6e 20 69 73 20 61 0d 0a | 60 60 73 74 72 69 6e 67 |n is a..|``string|
|00002320| 20 64 65 73 63 72 69 70 | 74 6f 72 2c 27 27 20 77 | descrip|tor,'' w|
|00002330| 68 69 63 68 20 69 73 20 | 7b 5c 69 74 20 6e 6f 74 |hich is |{\it not|
|00002340| 7d 20 61 20 73 74 72 69 | 6e 67 20 70 6f 69 6e 74 |} a stri|ng point|
|00002350| 65 72 20 69 6e 0d 0a 74 | 68 65 20 75 73 75 61 6c |er in..t|he usual|
|00002360| 20 43 20 73 65 6e 73 65 | 2e 20 20 49 6e 73 74 65 | C sense|. Inste|
|00002370| 61 64 2c 20 69 74 20 69 | 73 20 61 20 73 70 65 63 |ad, it i|s a spec|
|00002380| 69 61 6c 20 64 61 74 61 | 20 73 74 72 75 63 74 75 |ial data| structu|
|00002390| 72 65 20 74 68 61 74 0d | 0a 63 6f 6e 74 61 69 6e |re that.|.contain|
|000023a0| 73 20 74 68 65 20 6c 65 | 6e 67 74 68 20 6f 66 20 |s the le|ngth of |
|000023b0| 74 68 65 20 73 74 72 69 | 6e 67 20 61 6e 64 20 74 |the stri|ng and t|
|000023c0| 68 65 20 74 65 78 74 20 | 6f 66 20 74 68 65 20 73 |he text |of the s|
|000023d0| 74 72 69 6e 67 2e 20 20 | 54 41 44 53 0d 0a 76 65 |tring. |TADS..ve|
|000023e0| 72 73 69 6f 6e 20 32 20 | 64 6f 65 73 20 6e 6f 74 |rsion 2 |does not|
|000023f0| 20 75 73 65 20 43 2d 73 | 74 79 6c 65 20 6e 75 6c | use C-s|tyle nul|
|00002400| 6c 2d 74 65 72 6d 69 6e | 61 74 65 64 20 73 74 72 |l-termin|ated str|
|00002410| 69 6e 67 73 2c 20 62 75 | 74 20 72 61 74 68 65 72 |ings, bu|t rather|
|00002420| 0d 0a 6b 65 65 70 73 20 | 74 68 65 20 6c 65 6e 67 |..keeps |the leng|
|00002430| 74 68 20 6f 66 20 65 61 | 63 68 20 73 74 72 69 6e |th of ea|ch strin|
|00002440| 67 20 61 6c 6f 6e 67 20 | 77 69 74 68 20 69 74 73 |g along |with its|
|00002450| 20 74 65 78 74 20 76 61 | 6c 75 65 2e 20 20 59 6f | text va|lue. Yo|
|00002460| 75 0d 0a 63 61 6e 27 74 | 20 75 73 65 20 74 68 65 |u..can't| use the|
|00002470| 20 73 74 72 69 6e 67 20 | 64 65 73 63 72 69 70 74 | string |descript|
|00002480| 6f 72 20 64 69 72 65 63 | 74 6c 79 2c 20 62 75 74 |or direc|tly, but|
|00002490| 20 74 77 6f 20 66 75 6e | 63 74 69 6f 6e 73 20 61 | two fun|ctions a|
|000024a0| 72 65 0d 0a 70 72 6f 76 | 69 64 65 64 20 74 68 61 |re..prov|ided tha|
|000024b0| 74 20 61 6c 6c 6f 77 20 | 79 6f 75 20 74 6f 20 64 |t allow |you to d|
|000024c0| 65 63 6f 6d 70 6f 73 65 | 20 69 74 20 69 6e 74 6f |ecompose| it into|
|000024d0| 20 76 61 6c 75 65 73 20 | 79 6f 75 20 63 61 6e 20 | values |you can |
|000024e0| 75 73 65 2e 0d 0a 43 61 | 6c 6c 20 7b 5c 74 74 20 |use...Ca|ll {\tt |
|000024f0| 74 61 64 73 5c 5f 73 74 | 72 6c 65 6e 28 63 74 78 |tads\_st|rlen(ctx|
|00002500| 2c 20 7b 5c 69 74 20 73 | 74 72 7d 29 7d 2c 20 77 |, {\it s|tr})}, w|
|00002510| 68 65 72 65 20 7b 5c 69 | 74 20 73 74 72 7d 20 69 |here {\i|t str} i|
|00002520| 73 20 74 68 65 0d 0a 64 | 65 73 63 72 69 70 74 6f |s the..d|escripto|
|00002530| 72 20 76 61 6c 75 65 20 | 72 65 74 75 72 6e 65 64 |r value |returned|
|00002540| 20 62 79 20 7b 5c 74 74 | 20 74 61 64 73 5c 5f 70 | by {\tt| tads\_p|
|00002550| 6f 70 73 74 72 28 29 7d | 2c 20 74 6f 20 67 65 74 |opstr()}|, to get|
|00002560| 20 74 68 65 20 6c 65 6e | 67 74 68 0d 0a 6f 66 20 | the len|gth..of |
|00002570| 74 68 65 20 73 74 72 69 | 6e 67 3b 20 74 68 69 73 |the stri|ng; this|
|00002580| 20 66 75 6e 63 74 69 6f | 6e 20 72 65 74 75 72 6e | functio|n return|
|00002590| 73 20 61 6e 20 69 6e 74 | 65 67 65 72 20 67 69 76 |s an int|eger giv|
|000025a0| 69 6e 67 20 74 68 65 20 | 6e 75 6d 62 65 72 0d 0a |ing the |number..|
|000025b0| 6f 66 20 62 79 74 65 73 | 20 69 6e 20 74 68 65 20 |of bytes| in the |
|000025c0| 73 74 72 69 6e 67 2e 20 | 20 43 61 6c 6c 20 7b 5c |string. | Call {\|
|000025d0| 74 74 20 74 61 64 73 5c | 5f 73 74 72 70 74 72 28 |tt tads\|_strptr(|
|000025e0| 63 74 78 2c 20 7b 5c 69 | 74 20 73 74 72 7d 29 7d |ctx, {\i|t str})}|
|000025f0| 0d 0a 74 6f 20 67 65 74 | 20 74 68 65 20 74 65 78 |..to get| the tex|
|00002600| 74 20 6f 66 20 74 68 65 | 20 73 74 72 69 6e 67 3b |t of the| string;|
|00002610| 20 74 68 69 73 20 66 75 | 6e 63 74 69 6f 6e 20 72 | this fu|nction r|
|00002620| 65 74 75 72 6e 73 20 61 | 20 63 68 61 72 61 63 74 |eturns a| charact|
|00002630| 65 72 0d 0a 70 6f 69 6e | 74 65 72 20 67 69 76 69 |er..poin|ter givi|
|00002640| 6e 67 20 74 68 65 20 61 | 64 64 72 65 73 73 20 6f |ng the a|ddress o|
|00002650| 66 20 74 68 65 20 66 69 | 72 73 74 20 62 79 74 65 |f the fi|rst byte|
|00002660| 20 6f 66 20 74 68 65 20 | 73 74 72 69 6e 67 27 73 | of the |string's|
|00002670| 0d 0a 74 65 78 74 2e 20 | 20 4e 6f 74 65 20 74 68 |..text. | Note th|
|00002680| 61 74 20 74 68 65 20 73 | 74 72 69 6e 67 27 73 20 |at the s|tring's |
|00002690| 74 65 78 74 20 69 73 20 | 7b 5c 69 74 20 6e 6f 74 |text is |{\it not|
|000026a0| 7d 20 6e 75 6c 6c 2d 74 | 65 72 6d 69 6e 61 74 65 |} null-t|erminate|
|000026b0| 64 2d 2d 2d 79 6f 75 0d | 0a 6d 75 73 74 20 75 73 |d---you.|.must us|
|000026c0| 65 20 74 68 65 20 76 61 | 6c 75 65 20 66 72 6f 6d |e the va|lue from|
|000026d0| 20 7b 5c 74 74 20 74 61 | 64 73 5c 5f 73 74 72 6c | {\tt ta|ds\_strl|
|000026e0| 65 6e 28 29 7d 20 74 6f | 20 64 65 74 65 72 6d 69 |en()} to| determi|
|000026f0| 6e 65 20 74 68 65 20 6c | 65 6e 67 74 68 0d 0a 6f |ne the l|ength..o|
|00002700| 66 20 74 68 65 20 74 65 | 78 74 20 62 75 66 66 65 |f the te|xt buffe|
|00002710| 72 2e 20 20 42 65 20 63 | 61 72 65 66 75 6c 20 6e |r. Be c|areful n|
|00002720| 6f 74 20 74 6f 20 75 73 | 65 20 61 6e 79 20 6f 66 |ot to us|e any of|
|00002730| 20 74 68 65 20 43 20 66 | 75 6e 63 74 69 6f 6e 73 | the C f|unctions|
|00002740| 0d 0a 74 68 61 74 20 72 | 65 71 75 69 72 65 20 61 |..that r|equire a|
|00002750| 20 6e 75 6c 6c 2d 74 65 | 72 6d 69 6e 61 74 65 64 | null-te|rminated|
|00002760| 20 73 74 72 69 6e 67 20 | 77 69 74 68 20 74 68 65 | string |with the|
|00002770| 20 74 65 78 74 20 62 75 | 66 66 65 72 2c 20 62 65 | text bu|ffer, be|
|00002780| 63 61 75 73 65 0d 0a 74 | 68 65 20 62 75 66 66 65 |cause..t|he buffe|
|00002790| 72 20 64 6f 65 73 20 6e | 6f 74 20 68 61 76 65 20 |r does n|ot have |
|000027a0| 61 20 74 65 72 6d 69 6e | 61 74 69 6e 67 20 6e 75 |a termin|ating nu|
|000027b0| 6c 6c 20 62 79 74 65 2e | 0d 0a 0d 0a 59 6f 75 20 |ll byte.|....You |
|000027c0| 73 68 6f 75 6c 64 20 75 | 73 65 20 74 68 65 20 73 |should u|se the s|
|000027d0| 70 65 63 69 61 6c 20 74 | 79 70 65 20 7b 5c 74 74 |pecial t|ype {\tt|
|000027e0| 20 74 61 64 73 5c 5f 73 | 74 72 64 65 73 63 7d 20 | tads\_s|trdesc} |
|000027f0| 74 6f 20 68 6f 6c 64 20 | 74 68 65 20 72 65 74 75 |to hold |the retu|
|00002800| 72 6e 0d 0a 76 61 6c 75 | 65 20 6f 66 20 74 68 65 |rn..valu|e of the|
|00002810| 20 7b 5c 74 74 20 74 61 | 64 73 5c 5f 73 74 72 70 | {\tt ta|ds\_strp|
|00002820| 6f 70 28 29 7d 20 66 75 | 6e 63 74 69 6f 6e 2e 20 |op()} fu|nction. |
|00002830| 20 54 68 69 73 20 74 79 | 70 65 20 69 73 20 64 65 | This ty|pe is de|
|00002840| 66 69 6e 65 64 0d 0a 69 | 6e 20 7b 5c 74 74 20 54 |fined..i|n {\tt T|
|00002850| 41 44 53 45 58 49 54 2e | 48 7d 20 61 6c 6f 6e 67 |ADSEXIT.|H} along|
|00002860| 20 77 69 74 68 20 74 68 | 65 20 54 41 44 53 20 69 | with th|e TADS i|
|00002870| 6e 74 65 72 66 61 63 65 | 20 66 75 6e 63 74 69 6f |nterface| functio|
|00002880| 6e 73 2e 0d 0a 0d 0a 4e | 65 76 65 72 20 77 72 69 |ns.....N|ever wri|
|00002890| 74 65 20 69 6e 74 6f 20 | 61 20 74 65 78 74 20 62 |te into |a text b|
|000028a0| 75 66 66 65 72 20 6f 62 | 74 61 69 6e 65 64 20 77 |uffer ob|tained w|
|000028b0| 69 74 68 20 7b 5c 74 74 | 20 74 61 64 73 5c 5f 73 |ith {\tt| tads\_s|
|000028c0| 74 72 70 74 72 28 29 7d | 2e 0d 0a 54 41 44 53 20 |trptr()}|...TADS |
|000028d0| 61 73 73 75 6d 65 73 20 | 74 68 61 74 20 79 6f 75 |assumes |that you|
|000028e0| 20 77 69 6c 6c 20 6c 65 | 61 76 65 20 74 68 65 73 | will le|ave thes|
|000028f0| 65 20 74 65 78 74 20 62 | 75 66 66 65 72 73 20 75 |e text b|uffers u|
|00002900| 6e 63 68 61 6e 67 65 64 | 3b 0d 0a 6d 6f 64 69 66 |nchanged|;..modif|
|00002910| 79 69 6e 67 20 61 6e 20 | 61 72 67 75 6d 65 6e 74 |ying an |argument|
|00002920| 20 73 74 72 69 6e 67 27 | 73 20 74 65 78 74 20 62 | string'|s text b|
|00002930| 75 66 66 65 72 20 77 69 | 6c 6c 20 68 61 76 65 20 |uffer wi|ll have |
|00002940| 75 6e 70 72 65 64 69 63 | 74 61 62 6c 65 20 72 65 |unpredic|table re|
|00002950| 73 75 6c 74 73 2e 0d 0a | 0d 0a 41 66 74 65 72 20 |sults...|..After |
|00002960| 79 6f 75 20 68 61 76 65 | 20 72 65 74 72 69 65 76 |you have| retriev|
|00002970| 65 64 20 74 68 65 20 66 | 69 72 73 74 20 61 72 67 |ed the f|irst arg|
|00002980| 75 6d 65 6e 74 2c 20 79 | 6f 75 20 70 72 6f 63 65 |ument, y|ou proce|
|00002990| 65 64 20 77 69 74 68 20 | 6f 74 68 65 72 0d 0a 61 |ed with |other..a|
|000029a0| 72 67 75 6d 65 6e 74 73 | 20 69 6e 20 74 68 65 20 |rguments| in the |
|000029b0| 73 61 6d 65 20 6d 61 6e | 6e 65 72 2e 20 20 59 6f |same man|ner. Yo|
|000029c0| 75 20 7b 5c 69 74 20 6d | 75 73 74 7d 20 72 65 74 |u {\it m|ust} ret|
|000029d0| 72 69 65 76 65 20 61 6c | 6c 20 61 72 67 75 6d 65 |rieve al|l argume|
|000029e0| 6e 74 73 0d 0a 66 72 6f | 6d 20 74 68 65 20 73 74 |nts..fro|m the st|
|000029f0| 61 63 6b 20 77 69 74 68 | 20 6f 6e 65 20 6f 66 20 |ack with| one of |
|00002a00| 74 68 65 20 7b 5c 74 74 | 20 74 61 64 73 5c 5f 70 |the {\tt| tads\_p|
|00002a10| 6f 70 7b 5c 69 74 20 78 | 78 78 7d 28 63 74 78 29 |op{\it x|xx}(ctx)|
|00002a20| 7d 20 66 75 6e 63 74 69 | 6f 6e 73 2c 0d 0a 61 6e |} functi|ons,..an|
|00002a30| 64 20 79 6f 75 20 7b 5c | 69 74 20 6d 75 73 74 20 |d you {\|it must |
|00002a40| 6e 6f 74 7d 20 72 65 74 | 72 69 65 76 65 20 61 6e |not} ret|rieve an|
|00002a50| 79 20 6d 6f 72 65 20 74 | 68 61 6e 20 79 6f 75 20 |y more t|han you |
|00002a60| 72 65 63 65 69 76 65 64 | 2e 20 20 59 6f 75 20 63 |received|. You c|
|00002a70| 61 6e 0d 0a 66 69 6e 64 | 20 6f 75 74 20 68 6f 77 |an..find| out how|
|00002a80| 20 6d 61 6e 79 20 61 72 | 67 75 6d 65 6e 74 73 20 | many ar|guments |
|00002a90| 79 6f 75 72 20 66 75 6e | 63 74 69 6f 6e 20 61 63 |your fun|ction ac|
|00002aa0| 74 75 61 6c 6c 79 20 72 | 65 63 65 69 76 65 64 20 |tually r|eceived |
|00002ab0| 62 79 0d 0a 63 61 6c 6c | 69 6e 67 20 74 68 65 20 |by..call|ing the |
|00002ac0| 66 75 6e 63 74 69 6f 6e | 20 7b 5c 74 74 20 74 61 |function| {\tt ta|
|00002ad0| 64 73 5c 5f 61 72 67 63 | 28 63 74 78 29 7d 3b 20 |ds\_argc|(ctx)}; |
|00002ae0| 74 68 69 73 20 66 75 6e | 63 74 69 6f 6e 20 72 65 |this fun|ction re|
|00002af0| 74 75 72 6e 73 0d 0a 61 | 6e 20 69 6e 74 65 67 65 |turns..a|n intege|
|00002b00| 72 20 74 65 6c 6c 69 6e | 67 20 79 6f 75 20 74 68 |r tellin|g you th|
|00002b10| 65 20 61 63 74 75 61 6c | 20 6e 75 6d 62 65 72 20 |e actual| number |
|00002b20| 6f 66 20 61 72 67 75 6d | 65 6e 74 73 2e 20 20 28 |of argum|ents. (|
|00002b30| 54 68 69 73 0d 0a 66 75 | 6e 63 74 69 6f 6e 20 72 |This..fu|nction r|
|00002b40| 65 74 75 72 6e 73 20 74 | 68 65 20 61 63 74 75 61 |eturns t|he actua|
|00002b50| 6c 20 6e 75 6d 62 65 72 | 20 6f 66 20 61 72 67 75 |l number| of argu|
|00002b60| 6d 65 6e 74 73 20 72 65 | 67 61 72 64 6c 65 73 73 |ments re|gardless|
|00002b70| 20 6f 66 20 77 68 65 74 | 68 65 72 0d 0a 79 6f 75 | of whet|her..you|
|00002b80| 20 68 61 76 65 20 72 65 | 74 72 69 65 76 65 64 20 | have re|trieved |
|00002b90| 61 6e 79 20 61 72 67 75 | 6d 65 6e 74 73 3b 20 69 |any argu|ments; i|
|00002ba0| 74 20 64 6f 65 73 20 7b | 5c 69 74 20 6e 6f 74 7d |t does {|\it not}|
|00002bb0| 20 63 68 61 6e 67 65 20 | 61 73 20 79 6f 75 0d 0a | change |as you..|
|00002bc0| 70 6f 70 20 61 72 67 75 | 6d 65 6e 74 73 20 6f 66 |pop argu|ments of|
|00002bd0| 66 20 74 68 65 20 73 74 | 61 63 6b 2e 29 0d 0a 0d |f the st|ack.)...|
|00002be0| 0a 49 66 20 79 6f 75 72 | 20 75 73 65 72 20 65 78 |.If your| user ex|
|00002bf0| 69 74 20 72 65 74 75 72 | 6e 73 20 61 20 76 61 6c |it retur|ns a val|
|00002c00| 75 65 2c 20 79 6f 75 20 | 75 73 65 20 6f 6e 65 20 |ue, you |use one |
|00002c10| 6f 66 20 74 68 65 0d 0a | 7b 5c 74 74 20 74 61 64 |of the..|{\tt tad|
|00002c20| 73 5c 5f 70 75 73 68 7b | 5c 69 74 20 78 78 78 7d |s\_push{|\it xxx}|
|00002c30| 28 63 74 78 2c 20 7b 5c | 69 74 20 76 61 6c 75 65 |(ctx, {\|it value|
|00002c40| 7d 29 7d 20 66 75 6e 63 | 74 69 6f 6e 73 2e 20 20 |})} func|tions. |
|00002c50| 54 6f 20 72 65 74 75 72 | 6e 0d 0a 61 20 6e 75 6d |To retur|n..a num|
|00002c60| 62 65 72 2c 20 63 61 6c | 6c 20 7b 5c 74 74 20 74 |ber, cal|l {\tt t|
|00002c70| 61 64 73 5c 5f 70 75 73 | 68 6e 75 6d 28 63 74 78 |ads\_pus|hnum(ctx|
|00002c80| 2c 20 7b 5c 69 74 20 76 | 61 6c 75 65 7d 29 7d 2c |, {\it v|alue})},|
|00002c90| 20 77 68 65 72 65 20 7b | 5c 69 74 20 76 61 6c 75 | where {|\it valu|
|00002ca0| 65 7d 0d 0a 69 73 20 61 | 20 6c 6f 6e 67 20 69 6e |e}..is a| long in|
|00002cb0| 74 65 67 65 72 2e 20 20 | 54 6f 20 72 65 74 75 72 |teger. |To retur|
|00002cc0| 6e 20 61 20 74 72 75 74 | 68 20 76 61 6c 75 65 2c |n a trut|h value,|
|00002cd0| 20 63 61 6c 6c 20 7b 5c | 74 74 20 74 61 64 73 5c | call {\|tt tads\|
|00002ce0| 5f 70 75 73 68 74 72 75 | 65 28 63 74 78 29 7d 0d |_pushtru|e(ctx)}.|
|00002cf0| 0a 6f 72 20 7b 5c 74 74 | 20 74 61 64 73 5c 5f 70 |.or {\tt| tads\_p|
|00002d00| 75 73 68 6e 69 6c 28 63 | 74 78 29 7d 2e 20 20 54 |ushnil(c|tx)}. T|
|00002d10| 6f 20 72 65 74 75 72 6e | 20 61 20 43 2d 73 74 79 |o return| a C-sty|
|00002d20| 6c 65 20 73 74 72 69 6e | 67 20 28 74 68 61 74 20 |le strin|g (that |
|00002d30| 69 73 2c 20 61 0d 0a 6e | 75 6c 6c 2d 74 65 72 6d |is, a..n|ull-term|
|00002d40| 69 6e 61 74 65 64 20 73 | 74 72 69 6e 67 20 74 68 |inated s|tring th|
|00002d50| 61 74 20 79 6f 75 20 62 | 75 69 6c 74 20 6f 6e 20 |at you b|uilt on |
|00002d60| 74 68 65 20 43 20 73 74 | 61 63 6b 2c 20 75 73 69 |the C st|ack, usi|
|00002d70| 6e 67 20 61 20 6c 6f 63 | 61 6c 0d 0a 63 68 61 72 |ng a loc|al..char|
|00002d80| 61 63 74 65 72 20 61 72 | 72 61 79 20 76 61 72 69 |acter ar|ray vari|
|00002d90| 61 62 6c 65 29 2c 20 75 | 73 65 20 7b 5c 74 74 20 |able), u|se {\tt |
|00002da0| 74 61 64 73 5c 5f 70 75 | 73 68 63 73 74 72 28 63 |tads\_pu|shcstr(c|
|00002db0| 74 78 2c 20 7b 5c 69 74 | 20 70 6f 69 6e 74 65 72 |tx, {\it| pointer|
|00002dc0| 7d 29 7d 2c 0d 0a 77 68 | 65 72 65 20 7b 5c 69 74 |})},..wh|ere {\it|
|00002dd0| 20 70 6f 69 6e 74 65 72 | 7d 20 69 73 20 74 68 65 | pointer|} is the|
|00002de0| 20 61 64 64 72 65 73 73 | 20 6f 66 20 74 68 65 20 | address| of the |
|00002df0| 66 69 72 73 74 20 62 79 | 74 65 20 6f 66 20 74 68 |first by|te of th|
|00002e00| 65 20 73 74 72 69 6e 67 | 2e 0d 0a 0d 0a 59 6f 75 |e string|.....You|
|00002e10| 20 63 61 6e 20 61 6c 73 | 6f 20 61 73 6b 20 54 41 | can als|o ask TA|
|00002e20| 44 53 20 74 6f 20 61 6c | 6c 6f 63 61 74 65 20 73 |DS to al|locate s|
|00002e30| 70 61 63 65 20 66 6f 72 | 20 61 20 73 74 72 69 6e |pace for| a strin|
|00002e40| 67 2c 20 61 6e 64 20 62 | 75 69 6c 64 20 79 6f 75 |g, and b|uild you|
|00002e50| 72 0d 0a 72 65 74 75 72 | 6e 20 76 61 6c 75 65 20 |r..retur|n value |
|00002e60| 75 73 69 6e 67 20 74 68 | 69 73 20 73 70 61 63 65 |using th|is space|
|00002e70| 2e 20 20 43 61 6c 6c 20 | 7b 5c 74 74 20 74 61 64 |. Call |{\tt tad|
|00002e80| 73 5c 5f 73 74 72 61 6c | 6f 28 63 74 78 2c 20 7b |s\_stral|o(ctx, {|
|00002e90| 5c 69 74 20 6c 65 6e 7d | 29 7d 2c 0d 0a 77 68 65 |\it len}|)},..whe|
|00002ea0| 72 65 20 7b 5c 69 74 20 | 6c 65 6e 7d 20 69 73 20 |re {\it |len} is |
|00002eb0| 61 6e 20 69 6e 74 65 67 | 65 72 20 73 70 65 63 69 |an integ|er speci|
|00002ec0| 66 79 69 6e 67 20 74 68 | 65 20 6e 75 6d 62 65 72 |fying th|e number|
|00002ed0| 20 6f 66 20 62 79 74 65 | 73 20 69 6e 20 74 68 65 | of byte|s in the|
|00002ee0| 0d 0a 73 74 72 69 6e 67 | 20 79 6f 75 20 77 69 73 |..string| you wis|
|00002ef0| 68 20 74 6f 20 72 65 74 | 75 72 6e 2e 20 20 54 68 |h to ret|urn. Th|
|00002f00| 69 73 20 66 75 6e 63 74 | 69 6f 6e 20 72 65 74 75 |is funct|ion retu|
|00002f10| 72 6e 73 20 61 20 70 6f | 69 6e 74 65 72 20 74 6f |rns a po|inter to|
|00002f20| 20 74 68 65 0d 0a 66 69 | 72 73 74 20 62 79 74 65 | the..fi|rst byte|
|00002f30| 20 6f 66 20 74 68 65 20 | 61 6c 6c 6f 63 61 74 65 | of the |allocate|
|00002f40| 64 20 73 70 61 63 65 2e | 20 20 57 72 69 74 65 20 |d space.| Write |
|00002f50| 79 6f 75 72 20 73 74 72 | 69 6e 67 20 69 6e 74 6f |your str|ing into|
|00002f60| 20 74 68 69 73 20 73 70 | 61 63 65 2e 0d 0a 54 68 | this sp|ace...Th|
|00002f70| 65 20 73 74 72 69 6e 67 | 20 6d 75 73 74 20 7b 5c |e string| must {\|
|00002f80| 69 74 20 6e 6f 74 7d 20 | 62 65 20 6e 75 6c 6c 2d |it not} |be null-|
|00002f90| 74 65 72 6d 69 6e 61 74 | 65 64 3b 20 69 6e 73 74 |terminat|ed; inst|
|00002fa0| 65 61 64 2c 20 75 73 65 | 20 7b 5c 69 74 20 65 78 |ead, use| {\it ex|
|00002fb0| 61 63 74 6c 79 7d 0d 0a | 74 68 65 20 6e 75 6d 62 |actly}..|the numb|
|00002fc0| 65 72 20 6f 66 20 62 79 | 74 65 73 20 74 68 61 74 |er of by|tes that|
|00002fd0| 20 79 6f 75 20 61 6c 6c | 6f 63 61 74 65 64 2e 20 | you all|ocated. |
|00002fe0| 20 4f 6e 63 65 20 79 6f | 75 20 68 61 76 65 20 66 | Once yo|u have f|
|00002ff0| 69 6e 69 73 68 65 64 20 | 62 75 69 6c 64 69 6e 67 |inished |building|
|00003000| 0d 0a 79 6f 75 72 20 73 | 74 72 69 6e 67 2c 20 63 |..your s|tring, c|
|00003010| 61 6c 6c 20 7b 5c 74 74 | 20 74 61 64 73 5c 5f 70 |all {\tt| tads\_p|
|00003020| 75 73 68 61 73 74 72 28 | 63 74 78 2c 20 7b 5c 69 |ushastr(|ctx, {\i|
|00003030| 74 20 70 6f 69 6e 74 65 | 72 7d 29 7d 20 74 6f 20 |t pointe|r})} to |
|00003040| 70 75 73 68 0d 0a 74 68 | 65 20 72 65 74 75 72 6e |push..th|e return|
|00003050| 20 76 61 6c 75 65 2c 20 | 77 68 65 72 65 20 7b 5c | value, |where {\|
|00003060| 69 74 20 70 6f 69 6e 74 | 65 72 7d 20 69 73 20 74 |it point|er} is t|
|00003070| 68 65 20 76 61 6c 75 65 | 20 6f 72 69 67 69 6e 61 |he value| origina|
|00003080| 6c 6c 79 20 72 65 74 75 | 72 6e 65 64 0d 0a 62 79 |lly retu|rned..by|
|00003090| 20 7b 5c 74 74 20 74 61 | 64 73 5c 5f 73 74 72 61 | {\tt ta|ds\_stra|
|000030a0| 6c 6f 28 29 7d 2e 20 20 | 54 41 44 53 20 72 65 6d |lo()}. |TADS rem|
|000030b0| 65 6d 62 65 72 73 20 74 | 68 65 20 6c 65 6e 67 74 |embers t|he lengt|
|000030c0| 68 20 6f 66 20 62 75 66 | 66 65 72 20 79 6f 75 0d |h of buf|fer you.|
|000030d0| 0a 61 6c 6c 6f 63 61 74 | 65 64 2c 20 73 6f 20 74 |.allocat|ed, so t|
|000030e0| 68 65 72 65 20 69 73 20 | 6e 6f 20 6e 65 65 64 20 |here is |no need |
|000030f0| 74 6f 20 73 70 65 63 69 | 66 79 20 74 68 65 20 6c |to speci|fy the l|
|00003100| 65 6e 67 74 68 20 77 68 | 65 6e 20 72 65 74 75 72 |ength wh|en retur|
|00003110| 6e 69 6e 67 0d 0a 74 68 | 65 20 73 74 72 69 6e 67 |ning..th|e string|
|00003120| 2e 0d 0a 0d 0a 5c 65 6e | 64 63 68 61 70 74 65 72 |.....\en|dchapter|
|00003130| 0d 0a 53 6b 69 6c 6c 65 | 64 20 69 6e 20 74 68 65 |..Skille|d in the|
|00003140| 20 77 6f 72 6b 73 20 6f | 66 20 62 6f 74 68 20 6c | works o|f both l|
|00003150| 61 6e 67 75 61 67 65 73 | 2e 0d 0a 5c 61 75 74 68 |anguages|...\auth|
|00003160| 6f 72 20 48 4f 52 41 43 | 45 2c 20 7b 5c 73 6c 20 |or HORAC|E, {\sl |
|00003170| 53 61 74 69 72 65 73 7d | 20 28 32 33 20 42 2e 20 |Satires}| (23 B. |
|00003180| 43 2e 29 0d 0a 0d 0a 5c | 65 6a 65 63 74 0d 0a |C.)....\|eject.. |
+--------+-------------------------+-------------------------+--------+--------+